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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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
  • 615 views
  • 1 like
  • 2 in conversation