BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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