Hello again, sorry for all the posts.
Let's say I have a set of data:
ID Year
1 2007
1 2008
1 2010
2 2008
2 2009
3 2007
3 2010
3 2011
Now, let's say I only want to keep subjects who had their first info collected in 2007. This means I want to keep all info for subjects 1 and 3 and delete all info for subject 2.
I know how to accomplish this if I transpose the data or use an array (creating a column for each year and I can then just say if year2007 ne 1 then delete).
But what if I do not want to change the structure of the data and just want to keep the data as 1 long column of data. Is there some way to tell SAS to keep subjects based on whether or not their first observation happens in 2007?
Let's say I have a set of data:
ID Year
1 2007
1 2008
1 2010
2 2008
2 2009
3 2007
3 2010
3 2011
Now, let's say I only want to keep subjects who had their first info collected in 2007. This means I want to keep all info for subjects 1 and 3 and delete all info for subject 2.
I know how to accomplish this if I transpose the data or use an array (creating a column for each year and I can then just say if year2007 ne 1 then delete).
But what if I do not want to change the structure of the data and just want to keep the data as 1 long column of data. Is there some way to tell SAS to keep subjects based on whether or not their first observation happens in 2007?