I have two dates (start and stop), and I'm trying to create one column for each date between these two dates. Below is the summary of a macro I'm using. However, I'm getting this error: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. I was wondering if anyone could help me with this error. Thanks in advance! data have;
INFORMAT date_start date_stop MMDDYY10.;
input date_start date_stop ;
FORMAT date_start date_stop MMDDYY10.;
datalines;
1/15/2008 1/16/2008
1/28/2008 1/30/2008
2/12/2008 2/16/2008
;
data want;
INFORMAT date_start date_stop date_1 date_2 date_3 date_4 date_5 MMDDYY10.;
input date_start date_stop date_1 date_2 date_3 date_4 date_5;
FORMAT date_start date_stop date_1 date_2 date_3 date_4 date_5 MMDDYY10.;
datalines;
1/15/2008 1/16/2008 1/15/2008 1/16/2008
1/28/2008 1/30/2008 1/28/2008 1/29/2008 1/30/2008
2/12/2008 2/16/2008 2/12/2008 2/13/2008 2/14/2008 2/15/2008 2/16/2008
;
/* SAS macro code */
%macro test;
data want;
set have;
%do i = 1 %to date_stop - date_start + 1;
format date&i MMDDYY10.;
date&i = intnx('day', date_start, i);
%end;
run;
%mend;
%test
... View more