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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.