BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
EpiNovice
Calcite | Level 5

Hi Everyone,

 

I'm trying to carry a visit date across all rows of each participant ID, to create a start date column. I've used the below code to carry values across IDs in other coding, but now it just keeps telling me that _id is uninitialized. Is there something I'm missing? Is there a better way to do this?

 

Code:

data TOSStart(drop=_:);
do until (last.id);
set toscount;
by id;
if id > _id then do;
_Start = Start;
end;
end;
do until (last.id);
set toscount;
by id;
Start = _Start;
output;
end;
run;

 

Have this:

IDStart
11/1/2022
1 
1 
1 
43/5/2022
4 
4 
62/8/2022
6 
6 
6 
6 
6 
6 

 

Want this:

IDStart
11/1/2022
11/1/2022
11/1/2022
11/1/2022
43/5/2022
43/5/2022
43/5/2022
62/8/2022
62/8/2022
62/8/2022
62/8/2022
62/8/2022
62/8/2022
62/8/2022

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
EpiNovice
Calcite | Level 5
Worked like a charm, thanks!!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 756 views
  • 0 likes
  • 2 in conversation