I have a data set we'll say is simply called "MyDataset". Normally this would be saved as a file called "MyDataset.sas7bdat". However, some automated program on the server (not SAS) moves older files into an archive appends dates to the file - so now my file is called: "MyDataset.01Dec2022.sas7bdat"
How can I read this file in SAS without renaming the file? Third party ODBC connectors don't seem to have an issue, but I'm just trying to use windows sas.exe and I get all kinds of errors.
LibName myLib 'E:\Archive' ;
proc contents data =myLib.MyDataset.01Dec2022;
run;
-or-
proc contents varnum data='E:\Archive\MyDataset.01Dec2022.sas7bdat';
run;
If I rename the file so the filename matches the dataset name, I have no issues. How can I read the file without changing the file name?
Normally dots are not accepted as part of a data set name because of other syntax, such as the LIBNAME.DATASET rules.
If you want to use those non-standard names then you set the option Validmemname=Extend to allow non-standard dataset names and then use a name literal, the name enclosed in quotes followed by an N.
options validmemname=extend; proc contents data=mylib.'Mydataset.01Dec2022'n ; run;
Two things come to my mind.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.