04-06-2015 12:41 PM
I have an id variable, and I have multiple observations per id (patients with multiple specimens). I want to create a new ID variable containing 1 for the first ID, 2 for the second, and so on. I have a date variable. This in preparation for transposing the dataset to have one row per patient with columns for the variables related to specimen 1, specimen 2, etc. Open to ideas of better ways to do this, but I was going to use the new ID variable as my prefix.
04-06-2015 12:46 PM
proc sort data=have; by ID date;run;
Retain IdRec .;
if first.id the IdRec=1;