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!!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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
  • 872 views
  • 0 likes
  • 2 in conversation