BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
alepage
Barite | Level 11

Hello,

 

I am already using the macro below to get the latest modified file. As I am not very familiar with the Unix command, is there a way to improve this search tool to get the latest modified file in a folder for a file containing for example the word validation or the word scenario ?

 

%macro lastmodifiedfile(path,MName);

/** Change the filename below to the following to run on UNIX **/
/** filename test pipe "ls &path -rt"; **/

/** Change the filename below to the following to run on Windows **/
/** filename test pipe "dir &path /od /t:w /b"; **/

filename test pipe "ls &path -rt";

data _null_;
infile test;
input;
call symputx("&Mname.",_infile_,'g');
run;

%put Last file to be modified in &path is: &Mname.;

%mend lastmodifiedfile;
%lastmodifiedfile(/dwh_operation/sasdata/smp_production/prod_smpi2/pilot/,Fname);

 

So I would like to modified the above mentioned code to permit to add a part of the filename.

ex:

//.../pilote_2020_validation_v1.spde... 

//.../pilote_2020_validation_v2.spde... 

//.../pilote_2020_validation_v3.spde... 

//.../pilote_2020_validation_v3.spde... 

 

//.../pilote_2020_scenario_v1.spde... 

//.../pilote_2020_scenario_v2.spde... 

//.../pilote_2020_scenario_v3.spde... 

 

Moreover, I can't use the version number to trace the latest modified file.  So is there a way to modified the script to specify file containing the word validation, then the word scenario and so on.

 

Thank in advance for your help.

 

 

 

 

1 ACCEPTED SOLUTION
2 REPLIES 2

SAS Innovate 2025: Call for Content

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!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1169 views
  • 1 like
  • 2 in conversation