0% found this document useful (0 votes)
11 views5 pages

Project 1

The document outlines a SAS program that processes the SAShelp.class dataset to generate summary statistics for students based on gender. It includes steps for data manipulation, statistical calculations, and formatting the output into a report. The final report is exported to an RTF file and displayed with specific styling.

Uploaded by

akash behera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

Project 1

The document outlines a SAS program that processes the SAShelp.class dataset to generate summary statistics for students based on gender. It includes steps for data manipulation, statistical calculations, and formatting the output into a report. The final report is exported to an RTF file and displayed with specific styling.

Uploaded by

akash behera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Project Description.

Generate below output using SAShelp.class file.

Output

Code
data one;
set sashelp.class;
run;

data one1;
set one;
OUTPUT;
SEX = 'TOTAL';
OUTPUT;
RUN;

proc sort data= one1;


by sex;
run;

proc means data= one1 noprint;


var age height weight;
output out =dmg1
n= age_n hgt_n wgt_n
mean= age_mean hgt_mean wgt_mean
std= age_SD hgt_SD wgt_SD
min=age_min hgt_min wgt_min
max=age_max hgt_max wgt_max
median=age_median hgt_median wgt_median;
by sex;
run;

proc transpose data = dmg1 (DROP= _TYPE_ _FREQ_)


out=dmg2;
by sex;
run;

proc sort data= dmg2 out=ds2;


by _NAME_;
run;

data means ;
set ds2;

if substr(upcase(_NAME_),5,1) = 'N' then stat = 1;


if substr(upcase(_NAME_),5,4) = 'MEAN' then stat =
2;
if substr(upcase(_NAME_),5,2) = 'SD' then stat = 3;
if substr(upcase(_NAME_),5,3) = 'MIN' then stat =
4;
if substr(upcase(_NAME_),5,6) = 'MEDIAN' then stat
= 5;
if substr(upcase(_NAME_),5,3) = 'MAX' then stat =
6;

run;
proc sort data=means out=ds1;
by stat;
run;

data ds (drop= COL1);


set ds1;
if stat=1 then value= (put(COL1,7.0));
if stat=2 then value= (put(COL1,7.1));
if stat=3 then value= (put(COL1,7.2));
if stat=4 then value =(put(COL1,7.0));
if stat=5 then value =(put (COL1,7.2));
if stat=6 then value= (put(COL1,7.0));

run;

data scan (drop= stat _name_);


length name $5 value1 $6;
set ds;
name= scan(_name_ ,1,'_');
value1= right(scan(_name_ ,2,'_'));
run;

data ds3;
length SEX $10;
set scan;

if sex= 'F' then sex= 'female';


if sex= 'M' then sex= 'male';
if sex= 'T' then sex= 'total';
run;

Data ds3;
LENGTH SEX $ 10;
set SCAN;
if sex='F' then sex='female';
if sex='M' then sex='male';
if sex='T' then sex='total';
run;

proc sort data = ds3 out=sort;


by name value1;
run;

proc transpose data= sort out=ds4(drop=_NAME_);


by name value1;
id sex;
var value;
run;

proc print data= ds4 noobs;


run;

ods rtf file='C:\Users\King of Andhra\Desktop\New


folder\sree.rtf' style=minimal;
proc report data=DS4 headline headskip nowd
style=[frame=hsides rules=groups font_face="times new
roman" font_size=8 pt] ;
column name value1 female male total;
define name/'parameter' order WIDTH=8;
define value1/'stat' display;
define female/'female' display;
define male/'male' display;
define total/'total' display;
title'summary report of students';
footnote'generated by rajesh';
run;
ods rtf close;
proc report data=DS4 headline headskip nowd
style=[frame=hsides rules=groups font_face="times new
roman" font_size=8 pt] ;
column name value1 female male total;
define name/'parameter' order WIDTH=8;
define value1/'stat' display;
define female/'female' display;
define male/'male' display;
define total/'total' display;
title'summary report of students';
footnote'generated by rajesh';
run;

You might also like