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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.