BookmarkSubscribeRSS Feed
JJ7
Calcite | Level 5 JJ7
Calcite | Level 5

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;

1 REPLY 1
Reeza
Super User

 

 

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         



sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 578 views
  • 0 likes
  • 2 in conversation