Hello,
If you reference a dataset using a single name like A1 or A2 then it will look for WORK.A1 or WORK.A2. WORK datasets are removed when your SAS session ends.
If you want to instead find CHECK.A1 then say so in the SAS code you ask the macro processor to generate.
Note if you just want to check a set of datasets that end with a sequence of integers then there is no need for macro code. You can use a list of dataset names instead like this:
data want;
set check.a1 - check.a2;
run;
..in this case A5, it tells me files 1 to 4 do not exist
Do not paraphrase the messages. We need the exact word-for-word message. The best way is to show us the ENTIRE log from running this macro.
Please run this command first, to turn on macro debugging.
options mprint;
Then run your macro, and paste the log into the window that appears when you click on the </> icon. Do not skip this step.
And from now on, if you get errors, please do show us the log. Don't wait until we ask.
This is what my log shows. The issue seems to be that the macro code is searching for the files in my SAS library but they are not there. How do I change this code to look for these files A1 A2 A3 A4 A5 in my desktop? Maybe there isn't a way.
For that code to generate those messages you must have set the system option USER to the value MYSAS.
It used to be if you defined a libref named USER then single names dataset references, like the A1 and A2 in your code, would reference USER.A1 and USER.A2 instead of the normal WORK.A1 and WORK.A2. At some point in the last 20 years or so SAS added the USER system option where you could name a different libref instead.
You original code was making a libref named CHECK. But I did not see any code to make a libref named MYSAS.
If you reference a dataset using a single name like A1 or A2 then it will look for WORK.A1 or WORK.A2. WORK datasets are removed when your SAS session ends.
If you want to instead find CHECK.A1 then say so in the SAS code you ask the macro processor to generate.
Note if you just want to check a set of datasets that end with a sequence of integers then there is no need for macro code. You can use a list of dataset names instead like this:
data want;
set check.a1 - check.a2;
run;
Thank you!! That works.
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.