Parameters start_date
, end_date
& output_vars
. Dates are charter string. How can I convert it in a macro?
data _null_;
start =;
end = ;
diff=end date-startdate;
days = intck('day',start,end);
weeks = intck('week',start,end);
months = intck('month',start,end);
year = intck('year',start,end);
put days= weeks= months= year=;
run;
First if you have macro parameters then they will be macro variables and not data step variables. So you you need to reference the parameter value as &START_DATE, etc.
Second you can use the %SYSFUNC()
macro function to call the INTCK()
function in macro code.
Third you need to know the date format that will be used by the parameters. It is easiest if you just request that they use DATE
format, then you can use the parameter values as date literals.
%let start_date=01JAN2015 ;
%let end_date=01JAN2016 ;
%let days = %sysfunc(intck(day,"&start_date"d,"&end_date"d));