I'm running the following proc report and having an issue with the compute block. The only variable created in this step is CholGroup. When I run the code, all observations for CholGroup are <200 despite some readings being above 200 and others being missing. In the log, I receive a note stating 'variable chol is uninitialized'. Any advice on how to fix this would be appreciated.
proc report data=cb.blood;
column subject Gender AgeGroup chol CholGroup WBC;
where subject ge 990;
define subject / noprint;
define Gender / group width=8;
define AgeGroup / group width=8;
define Chol / width=8;
define WBC / width=8;
define CholGroup / 'Cholesterol Group' computed;
compute CholGroup / character length=6;
if chol lt 200 then CholGroup = '<200';
if chol gt 200 then CholGroup = '>=200';
endcomp;
define wbc / display;
run;
Use chol.sum (the default statistic) instead of chol. Or define chol as DISPLAY.
Use chol.sum (the default statistic) instead of chol. Or define chol as DISPLAY.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: