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

How to make this dateformat in SAS  11052021?

1 ACCEPTED SOLUTION

Accepted Solutions
asuman
Obsidian | Level 7

data test;
input date;
cards;
11052021
;
run;
data test1;
set test;
format newdate date10.;
newdate = input(put(date,8.),ddmmyy8.);
run;

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

What do you mean "make this dateformat"? Do you mean apply it to a variable?

 

11052021 does not have a clear meaning. Is it MMDDYYYY or DDMMYYYY or something else?

--
Paige Miller
mmea
Quartz | Level 8

i need to have a date that I make in this macro. Currently it gives me 11/05/21 - but i want it to come out like 11052021

%let todaysDate = %sysfunc(today(), DDMMYY8.);
%put &todaysDate;

 

PaigeMiller
Diamond | Level 26
%let todaysDate = %sysfunc(today(), DDMMYYN8.);

Please note: macro variables should not be formatted, except in rare instance, or when used in titles, labels or external file names. If you are not in one of these cases, do not format your macro variables.


Your example code should have ideally been included in your original question. You will get faster and more correct answers by being specific in your first post.

--
Paige Miller
mmea
Quartz | Level 8

thank you this only adds 110521 - can I add 2021

mmea
Quartz | Level 8

Sorry my bad it works

asuman
Obsidian | Level 7

data test;
input date;
cards;
11052021
;
run;
data test1;
set test;
format newdate date10.;
newdate = input(put(date,8.),ddmmyy8.);
run;
mmea
Quartz | Level 8

sorry i clicked wrong - this i not what I need - I need it as a macro so that I can put it in a file name

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!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 880 views
  • 1 like
  • 3 in conversation