I know what is going on .
data have;
input TOTAL_NOTE_BALANCE_15YR ;
cards;
45746
43473
.
.
.
43011
;
run;
data want;
do until(not missing(TOTAL_NOTE_BALANCE_15YR ) or last1);
set have end=last1;
end;
NEW_TOTAL_NOTE_BALANCE_15YR =TOTAL_NOTE_BALANCE_15YR ;
do until(not missing(TOTAL_NOTE_BALANCE_15YR ) or last2);
set have end=last2;
output;
end;
run;
When _n_ eq 1 :
the first do until will rolling here
45746 <---
43473
.
.
.
43011
;
assign 45746 to new variable.
the second do until will output this obs , so new variable retain 45746 and export to WANT dataset.
When _n_ eq 2 :
the first do until will rolling here
45746
43473 <---
.
.
.
43011
;
assign 43473 to new variable.
the second do until will output this obs , so new variable retain 43473 and export to WANT dataset.
When _n_ eq 3 :
the first do until will rolling here
45746
43473
.
.
.
43011 <---
;
assign 43011 to new variable.
the second do until will output the following 4 obs utill 43011 , so new variable retain 43011 and export to WANT dataset with these four obs .
etc...........
Thanks, Xia. So it is kind of nested DoW loop?
Yes. It is DOW skill has been mentioned by many people and many times.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.