I am very new to SAS. Below is the code I used for an if then do statement, but I am getting a syntax error message for the "end;" statement:
DATA Temp_Data;
X2 = X1;
X3 =0
if missing(X2) then do;
X2 = 5;
X3 = 1;
end;
run;
The error message states:
"ERROR 22-322: Syntax error, expecting one of the following: ..........."
What am I doing wrong?
Please advise. Thanks.
You're missing a semicolon on the previous line.
Not sure what version of SAS you have but I get that error message directly:
126 DATA Temp_Data;
127 X2 = X1;
128 X3 =0
129 if missing(X2) then do;
--
79
ERROR 79-322: Expecting a ;.
130 X2 = 5;
131 X3 = 1;
132 end;
133 run;
NOTE: The SAS System stopped processing this step because of
errors.
WARNING: The data set WORK.TEMP_DATA may be incomplete. When
this step was stopped there were 0 observations and 3
variables.
NOTE: DATA statement used (Total process time):
real time 0.13 seconds
cpu time 0.01 seconds
You're missing a semicolon on the previous line.
Not sure what version of SAS you have but I get that error message directly:
126 DATA Temp_Data;
127 X2 = X1;
128 X3 =0
129 if missing(X2) then do;
--
79
ERROR 79-322: Expecting a ;.
130 X2 = 5;
131 X3 = 1;
132 end;
133 run;
NOTE: The SAS System stopped processing this step because of
errors.
WARNING: The data set WORK.TEMP_DATA may be incomplete. When
this step was stopped there were 0 observations and 3
variables.
NOTE: DATA statement used (Total process time):
real time 0.13 seconds
cpu time 0.01 seconds
Thank you Reeza,
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: