Run the following program to create a temporary SAS data set called BLOOD. Produ
ID: 3232074 • Letter: R
Question
Run the following program to create a temporary SAS data set called BLOOD. Produce frequencies for WBCs (white blood cell counts) using the following cutoffs: For WBC, Low = 3,000 to 4,000; Medium = 4,001 to 6,000; High = 6,001 to 12,000. Values below 3,000 (but not missing) are to be labeled 'Abnormally Low', and values above 12,000 are to be labeled 'Abnormally High'. Finally, Missing values are to be labeled 'Not Available1. Write the necessary SAS statements to produce frequencies of all of these categories (omit the cumulative frequencies from the tables). Have the frequencies for missing values placed in the main table (use the TABLES option MISSING to do this). Do the recoding using a DATA step. Do the recoding using a format. Program to create data set BLOOD; DATA BLOOD; DO I = 1 TO 500; WBC = INT(RANNOR(1368)*2000 -* 5000); X = FANUNI(0); IF X UP .05 THEN WBC - .; ELSE IF X LT .1 THEN WBC = WBC - 3000; ELSE IF X LT .15 THEN WBC = WBC + 4000; OUTPUT; END; DROP I X; RUN;Explanation / Answer
DATA BLOOD;
DO I = 1 TO 500;
WBC =INT(RANNOR(1368)*2000+5000);
X=RANUNI(0);
IF X LT .05 THEN WBC = .;
ELSE IF X LT .1 THEN WBC = WBC - 3000;
ELSE IF X LT .15 THEN WBC =WBC + 4000;
OUTPUT;
END;
DROP I X;
RUN;
Proc freq data=BLOOD;
Tables WBC;
Run;
Data BLOOD1;
set BLOOD;
if WBC >= 3000 and WBC<4000 then ind="low";else
if WBC >= 4001 and WBC<6000 then ind="medium";else
if WBC >= 6000 and WBC<12000 then ind="high";else
if WBC > 0 and WBC< 3000 then ind="abnormally low";else
if WBC=. then ind = "not available";
run;
Proc freq data=BLOOD1;
TABLES ind;
run;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.