Please provide the SAS code for the question below: Compute the subject’s age (
ID: 3048815 • Letter: P
Question
Please provide the SAS code for the question below:
Compute the subject’s age (AGE) as of January 28, 2018 (round to the nearest year)
Using IF-THEN/ELSE statements in the DATA step, create the following categorical variables
WBC_GROUP with 3 levels from the variable WBCCOUNT, as follows:
WBC_GROUP WBCCOUNT
1 3 <= WBCCOUNT < 6
2 6 <= WBCCOUNT <= 10
3 > 10
AGE_GROUP with 3 levels from the variable AGE, as follows:
AGE_GROUP AGE
1 18 <= AGE <=35
2 35 < AGE <= 55
3 Greater than 55
Run Frequency Analysis on the newly created variables, WBC_GROUP and AGE_GROUP in the previous step.
Obtain the CROSS-TABULATION of WBC_GROUP and AGE_GROUP
Obtain the mean of FEV by WBC_GROUP and AGE_GROUP
Explanation / Answer
Sol:
age=floor((intck('month',birthday,today)-(day(today)< day(birthday)))/12);
GE----gretaer thanequal to
LT ---less than
GT--greater than
LE---less than or equal to
if WBCCOUNT GE 3 and WBCCOUNT LT 6 then WBC_GROUP =1;
else if WBCCOUNT GE 6 and WBCCOUNT LE 10 then WBC_GROUP =1;
ELSE if WBCCOUNT GT 10 then WBC_GROUP =3;
if AGE GE 18 and AGE LE 35 then AGE_GROUP=1;
else if AGE GT 35 and AGE LE 55 then AGE_GROUP=2;
ELSE if AGE GT 55 then AGE_GROUP=3;
proc freq data=<ds>;
tables WBC_GROUP ;
run;
proc freq data=<ds>;
tables AGE_GROUP;
run;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.