i want to call the fill name from the local directory. my file name will be month.xlsx. month name will be to the current month filename.
How can i include in the proc import the dynamic filename.
@radha009 wrote:
i want to call the fill name from the local directory. my file name will be month.xlsx. month name will be to the current month filename.
How can i include in the proc import the dynamic filename.
So if you ran it now would you expect to find February.xlsx or March.xlsx
The easiest way seems to use a macro variable.
%let month = %sysfunc(today(), monname20.);
%put &month.;
If sas is not running locally, you can't access local files.
my sas is running locally. i have full path in the Proc import data file. i have to change every month my script to the change the file name to generate a reprot.i am looking something that look for the filename from the folder.
Are you using display manager or enterprise guide? With EG you could add a prompt allowing you to select the file to import. The name can be computed if rules exist. If you just want the latest file in a folder, using cmd/powershell to get the filename is recommended, because, compared to a full-implementation in sas, less code is required. If you want / have to do it in sas have a look at the functions dopen, dnum, dread, fopen, finfo ...
@radha009 wrote:
i want to call the fill name from the local directory. my file name will be month.xlsx. month name will be to the current month filename.
How can i include in the proc import the dynamic filename.
So if you ran it now would you expect to find February.xlsx or March.xlsx
The easiest way seems to use a macro variable.
%let month = %sysfunc(today(), monname20.);
%put &month.;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.