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

/* Method #2 using the UPDATE statement */

data want;

update input_table (obs=0) input_table;

by id year;

run;

 

This is a great piece of code! Thank you for this. I would like to understand how it works though. Thanks again!

a079011
Obsidian | Level 7

I am trying to do something similar except, if value 1 has more then then one value I need the table to include an additional row.

 

DATA HAVE

 

Obs        id            year       value1   value2   value3

1              1              1999       -              270         350

2              1              1999       850         -              -

3              1              1999       450         -              -

4              2              2000       10           20           -             

5              2              2000      -              -              15

6              3              2001       -              55           -

7              3              2001       -              65           -

8              3              2001       -              75           -

9              4              2002       -              -              85

10           4              2002       99           -              -

 

DATA WANT

Obs        id            year       value1   value2   value3

1              1              1999       850         270         350

1              1              1999       450         -              -

2              2              2000       10           20           15

3              3              2001       -              55           -

4              3              2001       -              65           -

5              3              2001       -              75           -

6              4              2002       99           -              85

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!

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.

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
  • 16 replies
  • 67743 views
  • 3 likes
  • 13 in conversation