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,
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.