BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

In step 1 I want to add a new columns  called Ind_First_Row_Y_ne_Null.

It will get binary value 1 /0.

I want to know for each ID where is the first row where Y is not null.

Wanted data set  in step1 is

Ronein_0-1629967175566.png

What is the way to get it please?

 

Then in step 2 I want to delete for each ID all rows that are before First_Row_Y_ne_Null=1

 

In step 3 I want for each ID to mark the first row where month=. (Null)

Step 3 should be done from data sets that was created in step 2

 

What is the way to do it please?

 

 

 

 

Data have;
INPUT ID month Y;
cards;
1 2101 .
1 2102 .
1 2103 .
1 2104 10
1 2105 20
1 2106 30
1 2107 40
1 2108 50
2 2101 10
2 2102 15
2 2103 20
2 2104 30
2 2105 20
2 2106 50
2 2107 50
2 2108 40
3 2101 10
3 2102 15
3 2103 20
3 2104 .
3 2105 .
3 2106 .
3 2107 .
3 2108 .
4 2101 10
4 2102 15
4 2103 .
4 2104 .
4 2105 10
4 2106 15
4 2107 20
4 2108 15
;
Run;

 

 

1 REPLY 1
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
  • 1 reply
  • 556 views
  • 0 likes
  • 2 in conversation