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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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