- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
A number of ways.
Completely in SAS you can use a combination of SAS external file functions:
https://documentation.sas.com/doc/en/imlcdc/14.2/imlug/imlug_langref_sect561.htm
Or you can use X command/filename pipe to execute a dir/ls command to retrieve that information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I read it all but unable to use it, Although what I found using google says the physical file does not exist but its there in my network folder. And I am able to import that same file using proc import
The below is my code:
%let filepath = /SAS_library/NAS_CA/QR/QR/Import_file/MERMAST_INFILE.csv;
data _null_;
lastmod = attrn("&filepath.", "LM");
put "Last Modified Date: " lastmod datetime.;
run;
Please suggest what I should Do. Is there any solution for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is the file in question a SAS data set, other SAS file or something external to SAS such as a text file read for data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Its not a SAS data set its an external CSV file in my network folder.
Just to be clear I am able to import that CSV file using proc import. The task here for me is to check if the dumped file has last modified date of today then I want to schedule that job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How about using BasePlus package and the dirsAndFiles macro?
%dirsAndFiles(
</path/to/your/directory>
,ODS=work.outputDataSet
,keepDirs=0 /* ignore directories */
,details=1 /* get details */
,maxDepth=1 /* don't look in subdirectories */
)
And then use "LastModified" variable.
All the best
Bart
P.S. To install and use basePlus package do:
- Enable the framework [first time only]:
filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas"; %include SPFinit; /* enable the framework */
- Install the framework and the package on your machine in the folder you created:
filename packages "</your/directory/for/packages/>"; %installPackage(SPFinit basePlus)
- From now on, in your SAS session just run it like this (you can put those 3 lines in autoexec):
filename packages "</your/directory/for/packages/>"; %include packages(SPFinit.sas); %loadPackage(basePlus)
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug
"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings
SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation