BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Akter
Obsidian | Level 7

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sajid01
Meteorite | Level 14

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;

View solution in original post

2 REPLIES 2
Sajid01
Meteorite | Level 14

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;
Akter
Obsidian | Level 7
Thank you so much!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 482 views
  • 0 likes
  • 2 in conversation