BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Belle
Obsidian | Level 7

Thanks you all again. All the information are helpful. I learn so much from your all.

Astounding
PROC Star

SAS does contain a tool that may do exactly what you want.  Assuming your data are sorted:

data want;

  update have (obs=0) have;

  by id;

run;

That way, you can automatically expand this to many variables instead of just x, y, and z.

Good luck.

anan
Calcite | Level 5

Just another way

data want;

      set have;

      retain X_new Y_new Z_new ;

      by ID;

      array now(3) X Y Z;

      array three(3)X_new Y_new Z_new ;

      do i=1 to 3;

            if ID=lag(ID) then do;

                  if now(i)^=. then three(i)=now(i);

            end;

      end;

if last.ID then output want;

drop x y z;

run;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 17 replies
  • 5919 views
  • 10 likes
  • 9 in conversation