Dear SAS community,
I have two SAS files (Lung) that has one row per study subject. This first file has the baseline characteristics. The second SAS file (Lung_followup) has the follow-up data for the study subjects. This second file may have zero or more rows per study subject. The number of rows is dependent on the number of years of follow-up the study subject has accrued. For example, those that do not have one year of follow-up do not have any rows in this second file while those that have 5 years of follow-up will have 5 rows. The second file has the rows in chronological order, e.g. the first row corresponds to the first year follow-up and the second to the second year follow-up.
I am trying to merge the two aforementioned SAS files in a single file (Lung_merge). My goal is to have a file that has one row per patient and contains the baseline characteristics of the first SAS file (Lung) and the 3 year follow-up data (third row of the second file). If the study subject doesn't have 3 year follow-up data I don't want to include it in the merged file (Lung_merge).
Could you please help me with the code? This is what I have so far and I am quite far from achieving my goal.
Data Lung_Merge;
Merge Lung (IN=in1) Lung_followup (IN=in2);
By TRR_ID_CODE;
Run;
Thank you for your advice. I use SAS 9.4
Best