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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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