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         



Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

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
  • 1 reply
  • 297 views
  • 0 likes
  • 2 in conversation