BookmarkSubscribeRSS Feed
arpit
Calcite | Level 5
System date is 03/03/2011

I want to create a dataset like A
DATE
02-03-2011
01-03-2011
28-02-2011
27-02-2011
26-02-2011
25-02-2011

Kindly help me
5 REPLIES 5
ieva
Pyrite | Level 9
Hi,

Try this:

%macro datelist;
data date_list (keep=date);
sysdate=%sysfunc(date());
format date date9.;
%do i=1 %to 6;
date=sysdate-&i;
output;
%end;
run;
%mend;
%datelist;
arpit
Calcite | Level 5
how to convert it into checracter data type
ieva
Pyrite | Level 9
Usin Ksharp's code which is more simple to get character value:

data A;
do i=1 to 10;
date=put(put(today() - i, ddmmyyd10.), $10.);
output;
end;
drop i;
run;
arpit
Calcite | Level 5
Thanks a lot ieva and Ksharp for ur kind information
Ksharp
Super User
[pre]
data A;
do i=1 to 10;
date=today() - i;
output;
end;
format date ddmmyyd10.;
drop i;
run;
[/pre]


Ksharp

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 5 replies
  • 883 views
  • 0 likes
  • 3 in conversation