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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—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.