Suppose I have 2 dates column. If I take difference of date I get months, the difference of two dates is 2months.
I want to update column Month1-Month11 as 1 and 0 for other columns(Month12-Month24=0).
I tried using array but it updated only column Month11 as 1. I want to update all columns before Month12(Month1-Month11)
Thank you in advance.
data want;
set have;
array m m1-m12;
do i=1 to dim(m);
if i<diff then m(i)=1;
else m(i)=0;
end;
run;
Please explain in more detail. Show us a small example. Show us the desired output from the small example. Show us the code you tried that didn't work.
data want;
set have;
array m m1-m12;
do i=1 to dim(m);
if i<diff then m(i)=1;
else m(i)=0;
end;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.