Could you please explain the codes Interlace stacking and the classic 2X DOW
How did they get the names?
Whats the benifit of setting the same dataset twice?
eg:
data want;
set have have; etc etc
THANKS IN ADVANCE
*QUESTION;
*HOW TO SEPERATE SUBJECTS WITH MULTIPLE OCCURANCES THAT SATISFY A CERTAIN CONDITION?????;
*I NEED TO SEPERATE THE RECORDS WHERE ARRERS_BAND(VARIABLE NAME) ATLEAST ONCE HAD "WRITOFF" VALUE;
data have;
informat Current_date date9.;
Input Current_date Account_number Arrears_Band :$15.;
Format Current_date date9.;
cards;
31MAY2011 111 NPNA
30JUN2011 111 writoff
31JUL2011 111 NPNA
31AUG2011 111 NPNA
30SEP2011 111 NPNA
31OCT2011 111 NPNA
30NOV2011 111 NPNA
31DEC2011 111 NPNA
31JAN2012 111 NPNA
31DEC2011 222 NPNA
31JAN2012 222 NPNA
30NOV2010 333 NPNA
31DEC2010 333 NPNA
31JAN2011 333 NPNA
28FEB2011 333 NPNA
31MAR2011 333 writoff
30APR2011 333 NPNA
31MAY2011 333 NPNA
30JUN2011 333 NPNA
31JUL2011 333 NPNA
31AUG2011 333 NPNA
30SEP2011 333 NPNA
31OCT2011 333 NPNA
30NOV2011 333 NPNA
31DEC2011 333 NPNA
31JAN2012 333 NPNA
28FEB2010 444 Current
31MAR2010 444 30 - 60
30APR2010 444 30 - 60
31MAY2010 444 Current
30JUN2010 444 Current
31JUL2010 444 Current
31AUG2010 444 Current
30SEP2010 444 Current
31OCT2010 444 Current
30NOV2010 444 Current
31DEC2010 444 Current
31JAN2011 444 1 - 30
28FEB2011 444 30 - 60
31MAR2011 444 60 - 90
30APR2011 444 90 +
31MAY2011 444 90 +
30JUN2011 444 90 +
31JUL2011 444 NPNA
31AUG2011 444 NPNA
30SEP2011 444 NPNA
31OCT2011 444 NPNA
30NOV2011 444 NPNA
31DEC2011 444 NPNA
31JAN2012 444 NPNA
28FEB2010 555 30 - 60
31MAR2010 555 30 - 60
30APR2010 555 60 - 90
31MAY2010 555 NPNA
31JAN2012 666 writoff
31JAN2012 777 NPNA
;
run;
/*Interlace Stacking*/
data want;
set have (in=up) have;
by account_number;
if first.account_number then call missing(flag);
if up and Arrears_Band='writoff' then flag+1;
run;
if not up and flag>=1 then output;
drop flag;
run;
/*Classic 2X DOW*/
data want;
do until (last.account_number);
set have;
by account_number;
if Arrears_Band='writoff' then flag+1;
end;
do until (last.account_number);
set have;
by account_number;
if flag >=1 then output;
end;
call missing(flag);
drop flag;
run;
/*Merge*/
data want;
merge have (where=(Arrears_Band='writoff') in=a) have (in=b);
by account_number;
if a and b;
run;
/*Hash()*/
data want;
if _n_=1 then do;
if 0 then set have;
dcl hash h(dataset:'have', multidata:'y');
h.definekey('account_number');
h.definedata(all:'y');
h.definedone();
end;
do until (last.account_number);
set have;
by account_number;
if Arrears_Band='writoff' then flag+1;
end;
if flag>=1 then do;
rc=h.find();
do rc=0 by 0 while (rc=0);
output;
rc=h.find_next();
end;
end;
call missing(flag);
drop flag rc;
run;
It is really called interleaving. Take a look at: http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001293111.htm
I responded to your earlier post with a brief explanation of how a DOW loop works.
I think you're better off reading up on the generalities of DOW loops and seeing how it applies to your code.
You can find useful papers at lexjansen.com, for example here's a paper that explains a double dow loop:
http://www.lexjansen.com/wuss/2009/tut/TUT-Allen.pdf
Did you mean interleaving or interlacing? I'm not familiar with interlacing term...so no help there .
Firstly thanks for the reply.
If you look below the data the code is already posted with various names. First of the codes is written as Interlace stacking. I do not know it myself why that piece of code is called by that name
It is really called interleaving. Take a look at: http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001293111.htm
I responded to your earlier post with a brief explanation of how a DOW loop works.
Yes Sir,
Great Help
Thanks a ton
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!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.