0

I have the following two macro variables:

%let start_date = 29MAY2014;
%let end_date = 15JUL2014;

I would like to create a dataset which is a series of dates between these (inclusive.) I cannot change the input format of the macro variables &start_date and &end_date.

I have tried many variations of the following, but SAS spits out an error for each:

data base_dates;
   do date = put("&start_date",date9.) to put("&end_date",date9.);
      output;
   end;
   format date date11.;
run;

Any help in this would be much appreciated

andrey_sz
  • 751
  • 1
  • 13
  • 29
datavoredan
  • 3,536
  • 9
  • 32
  • 48

2 Answers2

1

Use them as date literals, enclose in quotes and add a d at the end.

Do date = "&start_date"d to "&end_date"d;
Reeza
  • 20,510
  • 4
  • 21
  • 38
0

It was simple; input() instead of put()

data base_dates;
do date = input("&start_date",date9.) to input("&end_date",date9.);
output;
end;
format date date11.;
run;
datavoredan
  • 3,536
  • 9
  • 32
  • 48