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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.