Hi all!
For most of my reports I am able to just use &eom. in my file extensions, but for a project I am working on, I need to be able to import a file based on its file extension of the previous Wednesdays date in DDMMYYN8. format. I have looked through the other questions and found the following, but when I use it, it exports with the SAS date format and not the format I want, and I cant seem to figure out how to format it.
data _null_;
today="&SYSDATE9"d;
lastwk=intnx('week', today, -1);
lastwed=intnx('week.4', lastwk , 1);
run;
data _null_;
lastWed = intnx('week', today(), 0, 'b') - 4;
call symputx('lastWed', put(lastWed, ddmmyyn8.));
run;
%put &lastWed.;
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 68 69 data _null_; 70 71 lastWed = intnx('week', today(), 0, 'b') - 4; 72 73 call symputx('lastWed', put(lastWed, ddmmyyn8.)); 74 75 run; NOTE: DATA statement used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 482.90k OS Memory 23456.00k Timestamp 10/15/2020 02:21:44 AM Step Count 30 Switch Count 0 Page Faults 1 Page Reclaims 153 Page Swaps 0 Voluntary Context Switches 1 Involuntary Context Switches 0 Block Input Operations 344 Block Output Operations 0 76 77 %put &lastWed.; 07102020 78 79 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 89
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.