BookmarkSubscribeRSS Feed
Jesusismygrace
Obsidian | Level 7

Hi, I can't seem to get this code to work.

 

data BSC_mbr_2021b;
set BSC_mbr_2021;
if (payercode = 'C' and productcode = 'H') or (payercode = 'C' and productcode = 'S') then do;
product = 'Commercial HMO POS';
output;
else do;
product = 'Other';
output;
end;
run;

 

I get this error message.

 

24
25 GOPTIONS ACCESSIBLE;
26 data BSC_mbr_2021b;
27 set BSC_mbr_2021;
28 if (payercode = 'C' and productcode = 'H') or (payercode = 'C' and productcode = 'S') then do;
29 product = 'Commercial HMO POS';
30 output;
31 else do;
____
160
ERROR 160-185: No matching IF-THEN clause.

32 product = 'Other';
33 output;
34 end;
35 run;

35 run;
_
117
ERROR 117-185: There was 1 unclosed DO block.

 

2 REPLIES 2
ballardw
Super User

 

 

data BSC_mbr_2021b;
set BSC_mbr_2021;
if (payercode = 'C' and productcode = 'H') or (payercode = 'C' and productcode = 'S') then do;
product = 'Commercial HMO POS';
output;
end; /* to end the first "then do" */
else do;
product = 'Other';
output;
end;
run;
Jesusismygrace
Obsidian | Level 7
Thank you!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 500 views
  • 1 like
  • 2 in conversation