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

Hi,

I am New to SAS & practicing on SAS university Edition. while practicing for If-then-else statement, I am getting below error;

"ERROR 388-185: Expecting an arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored."
 
Below is the complete code from editor:
 

data work.newfile;
 set sashelp.heart;
 Where Smoking_Status='Non-smoker';
 if Weight>100, then Weight_Status='Underweight';
 if Weight<100, then Weight_Status='Overweight';
 Keep Status Sex Height Weight Weight_Status Smoking Smoking_Status;
run;

proc contents data=work.newfile;
run;

proc print data=work.newfile;
run;

 

Please help on these.  
 
I tried all possible solutions from my side. 
If anyone he
1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

There shouldn't be a comma after the expression Weight>100, 

 

if Weight>100, then Weight_Status='Underweight';
 if Weight<100, then Weight_Status='Overweight';

 

correction:

 

if Weight>100 then Weight_Status='Underweight';
else  if Weight<100 then Weight_Status='Overweight';

 

View solution in original post

1 REPLY 1
novinosrin
Tourmaline | Level 20

There shouldn't be a comma after the expression Weight>100, 

 

if Weight>100, then Weight_Status='Underweight';
 if Weight<100, then Weight_Status='Overweight';

 

correction:

 

if Weight>100 then Weight_Status='Underweight';
else  if Weight<100 then Weight_Status='Overweight';

 

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

Discussion stats
  • 1 reply
  • 4529 views
  • 0 likes
  • 2 in conversation