0% found this document useful (0 votes)
3 views

SAS Leonardo D. Villamil. HW 3. 10/01/2015.: 'C:/sashw'

This document contains code to analyze heart disease data and student grades data. For the heart disease data, it calculates summary statistics by sex and cholesterol status and formats the cholesterol status as a categorical variable. For the student grades data, it imports a spreadsheet, renames and rescales the quiz scores, calculates a total score, sorts by total, and prints the results with name and total score.

Uploaded by

kaliman2010
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SAS Leonardo D. Villamil. HW 3. 10/01/2015.: 'C:/sashw'

This document contains code to analyze heart disease data and student grades data. For the heart disease data, it calculates summary statistics by sex and cholesterol status and formats the cholesterol status as a categorical variable. For the student grades data, it imports a spreadsheet, renames and rescales the quiz scores, calculates a total score, sorts by total, and prints the results with name and total score.

Uploaded by

kaliman2010
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SAS

Leonardo D. Villamil.
HW 3.
10/01/2015.
PART 1
libname sashw 'C:\sashw';
data heart;
set sashw.heart;
if Status = 'Alive';
run;
proc means data = heart maxdec = 1 mean median p10 p90 stddev nolabels ;
var AgeAtStart Height Weight Diastolic Systolic Cholesterol;
ODS NOPROCTITLE;
title ;
run;
PROC FORMAT ;
Value $Class
'High' = 'High Cholesterol Level'
'Desirable' = 'Healthy Cholesterol Level'
'Borderline' = 'Borderline Cholesterol Level';
run;
proc sort data = heart sortseq = linguistic (strength = primary);
by sex ;
run;
proc means data= heart maxdec = 1 mean median p10 p90 stddev ;
by sex ;
class chol_status;
var cholesterol;
Format Chol_status $class.;
TITLE 'The Heart Study';
TITLE2 'Analysis of the Survivors';
TITLE3 'By';
TITLE4 'Sex and Cholesterol Status';
run;

Output Part 1

Part 2.
PROC IMPORT DATAFILE ='C:\sashw\Grades.xlsx'
out
= grades (rename=(Q1-Q12= Quiz1-Quiz12) )
dbms
= xlsx replace;
run;
data grades;
set grades;
array g(12) Quiz1-Quiz12;
do i=1 to 12;
g(i) = 10*g(i)+2;
end;
drop i;
Total = sum(of Quiz1-Quiz12);
proc sort data = grades ;
by descending Total;
run;
proc print data = grades;
title;
id Name Total;
run;
Output Part 2

You might also like