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
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;
You can apply the same mechanisms I gave you in your other question.
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!
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.