Hello i have the below data & the program. How come the number of observation in work.test3 has 4 observations instead of 3.
data dbp;
input id sbp dbp;
datalines;
2001 145 92
2002 130 87
2003 117 78
2004 135 85
2005 145 79
;
run;
data
work.test1
work.test2
work.test3;
set dbp;
if sbp gt 140 and dbp gt 90 then output work.test1;
if sbp gt 120 and dbp lt 80 then output work.test2;
else output work.test3;
run;
Thank you in advance for your help.
Akter
Hello
Add an else as shown below. It will solve your issue
data
work.test1
work.test2
work.test3;
set dbp;
if sbp gt 140 and dbp gt 90 then output work.test1;
else
if sbp gt 120 and dbp lt 80 then output work.test2;
else output work.test3;
run;
Hello
Add an else as shown below. It will solve your issue
data
work.test1
work.test2
work.test3;
set dbp;
if sbp gt 140 and dbp gt 90 then output work.test1;
else
if sbp gt 120 and dbp lt 80 then output work.test2;
else output work.test3;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.