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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1070 views
  • 0 likes
  • 3 in conversation