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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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