It is possible that you submitted code without a RUN; statement and that did not include any procedure or other statement after the data step that tells SAS to imply that a run was implied.
Hint: if you write code end procedures with the appropriate Run; or Quit; statement when needed. It will save many headaches in the long run. The bit that SAS will usually figure out what to do from syntax fails when nothing follows.
Or show us the code of the data step and what follows.
One of the reasons to include code is because it very often shows the problem.
And we have a winner.
If number = 1234 then city = ‘City Name’;
You are not using quotes that SAS understands. The "curly" quotes are likely the cause.
SAS expects quotes to look like '
The most common precipitant of this behavior in my experience is when I submit code for a single data step and forget to append a "RUN;" statement. The fix is to follow up with a "RUN;".
But, if in the same SAS session, I follow this up with another "incomplete" DATA step, the first one will run.
Without seeing the code you are running, it's impossible to tell where the error lies. It could be a missing closed quote, for example:
data zip2;
set code.zip1;
where year in (2015 2016 2017 2018 2019);
if number = 1234 then city = ‘City Name;
run;
Now "run;" becomes part of the value being assigned to CITY.
As a general strategy, though, I would start with a fresh session. Where the non-running code begins, replace it with:
data _null_;
set code.zip1;
run;
If this step runs, you know the problem is in the DATA step. If this step doesn't run, you know the problem lies in the earlier code that establishes your libraries, etc.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.