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.
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.