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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.