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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.