I have a table below and I want to create a table where the first 'ID' is 'test'' =1. If the first 'ID' isn't 'test' =1 then to have it in a separate column.
ID
date
test
1
6/7/18
8/12/28
2
5/4/18
3
6/20/18
10/4/18
4
5/8/18
7/23/18
5
3/9/18
7/4/18
11/20/18
I want the output to look like this
Test1
Test2
You missed to sign the first of ID=4.
Assuming data is sorted by ID then:
data want; set have; by ID; if first.id then test=1; else test=.; run; options missing=' ';
View solution in original post
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Latest Updates
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.