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

I have a dataset

 

columns:    A                B                    C           D

                  APPLE      BALL              123         .

                 APPLE       BALL                 .           123

 

 

I WANT AN OUTPUT TO BE LIKE FOLLOWING

           A                       B                       C            D

      APPLE                 BALL               123           123 

 

How can I solve this in single step ? Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

If it takes just column A to determine a unique observation:

 

data want;

update have (obs=0) have;

by a;

run;

 

If it takes the combination of both columns A and B, switch to:

 

data want;

update have (obs=0) have;

by a b;

run;

 

In any case, the data need to be in sorted order to be allowed to use the BY statement.

View solution in original post

3 REPLIES 3
Astounding
PROC Star

If it takes just column A to determine a unique observation:

 

data want;

update have (obs=0) have;

by a;

run;

 

If it takes the combination of both columns A and B, switch to:

 

data want;

update have (obs=0) have;

by a b;

run;

 

In any case, the data need to be in sorted order to be allowed to use the BY statement.

purveshrana
Fluorite | Level 6

I figured out a way. Thank you.

Reeza
Super User

@purveshrana for completion, please post the solution or mark one here as correct. 

 

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
  • 3 replies
  • 1066 views
  • 2 likes
  • 3 in conversation