Dear SAS users, I have the following "vertical" dataset that represents doctor visits for 4 patients (every patient may have one or more visits): PatientID visitN visitDate labResult 1 0 03/15/2016 10 1 1 03/15/2017 20 1 2 09/20/2017 20 2 0 06/15/2016 30 2 1 10/15/2016 30 3 0 03/15/2016 10 4 0 05/15/2016 20 4 1 08/20/2016 20 4 2 03/15/2017 20 I would like to create several new variables: 1. T1 = to the FIRST visit (i.e., visitN = 0) . Basically, my T1 for each patient will be equal to bolded dates. 2. nDaysSince1stvisit - number of days since T1 (i.e., since the first visit) May somebody direct me to how to do it? Thank you very much ahead. Julia P.S. Eventually, I would like to get a "horizontal" dataset with 1 line per patient and with the labResults data for T1 (first visit), T2_1month (the visit in 1 month since the first one), and T3_1year (the visit in 1 year since the first one). However, to avoid confusion, I thought I would rather ask step by step.
... View more