Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

data testdata1; infile "D:\1.txt"; input no weight height; run; data testdata1; input no weight height; datalines; 1 101.

7 178 2 97.1 170 3 114.2 191 4 101.9 179 5 93.1 182 6 108.1 177 7 85.0 184 8 89.1 182 9 95.8 179 10 97.8 183 11 78.7 . 12 77.5 172 13 102.8 183 14 81.1 169 15 102.1 177 16 112.1 180 17 89.7 184 ; run; proc contents data=testdata1; by id height; run; proc print data=testdata1; run; proc print data=testdata1 noobs; run; data testdata1; set testdata1; height = height /100; bmi=(weight/(height*height)); if bmi<18.5 then group="underweight"; else if bmi<25 then group="normal"; else if bmi<30 then group="overweight"; else group="obese"; run; proc print data=testdata1 noobs; run; data testdata1; set testdata1; height = height /100; bmi=(weight/(height*height)); if bmi<18.5 then group=1; else if bmi<25 then group=2;

else if bmi<30 then group=3; else group=4; run; proc format; value bmigroup 1="under weight" 2="normal weight" 3="overweight" 4="obese"; run; proc print data=testdata1 noobs; format group bmigroup.; title 'report bmi group in words'; var no weight height group; run; data respire; input treat $ outcome $ count ; cards; placebo f placebo s test f test s ; run; data resp; set respire; rename treat= treatment; run; proc print data = resp; run; data respire; input treat $ outcome $ count ; cards; placebo f placebo s test f test s ; run; data resp; set respire; drop count; run; proc print data = resp; run; data respire; input treat $ outcome $ count ; cards; placebo f placebo s test f test s ; run;

16 48 40 20

16 48 40 20

16 48 40 20

data resp; set respire; keep count; run; proc print data = resp; run; data respire; input treat $ outcome $ count ; cards; placebo f placebo s test f test s ; run; data resp; set respire; keep count; run; proc print data = resp; run; data respire; input treat $ outcome $ count ; cards; placebo f placebo s test f test s ; run; data resp; set respire; label count =ct; run; proc print data = resp; run; data testdata1; input no weight height; TOTAL=SUM(weight,height); datalines; 1 101.7 178 2 97.1 170 3 114.2 191 4 101.9 179 5 93.1 182 6 108.1 177 7 85.0 184 8 89.1 182 9 95.8 179 10 97.8 183

16 48 40 20

16 48 40 20

11 78.7 . 12 77.5 172 13 102.8 183 14 81.1 169 15 102.1 177 16 112.1 180 17 89.7 184 ; data truncate; Var1=6.478; NewVar1=ceil(Var1); NewVar2=floor(Var1); NewVar3=int(Var1); run;

proc sort data=testdata1 out=tdata2;

by

descending height;

run; proc means data=testdata1; var height weight; run; proc freq data=testdata1 tables height weight; ;

run; proc univariate data=testdata1 var height weight; histogram height; run; proc plot data=tdata2; plot height*weight / vaxis = 170 to 190 by 10 haxis = 70 to 120 by 10; run; ;

proc chart data=tdata2; hbar weight /midpoints=(80 90 100); vbar height; run;

You might also like