Hi, Below is longitudinal diabetes (y/n) data, I want to search for the first time a 0 or 1 appears so I can call that a baseline value. And also search for when a 1 appears so I know if the person developed diabetes. There are corresponding days2-days19 variables that are the f/u time (days from visit1) for each diabx field. So for example, obs=1242, I want to say baseline diabetes=0 occurred at the 3rd visit, and that a diabetes diagnosis was recorded at visit7, so total f/u time from baseline to diabetes diagnosis would be days7-days3. For now, we aren't worrying about the missing data between visits. I hope I explained this correctly. Thanks for any help!! Also, I don't use proc SQL very much so if it can be in a data step that would be awesome, otherwise if that's too complicated, SQL works Obs diab1 diab2 diab3 diab4 diab5 diab6 diab7 diab8 diab9 diab10 diab11 diab12 diab13 diab14 diab15 diab16 diab17 diab18 diab19 528 . . . 0 . . . . . . . . . . . . . . . 670 . . . . . . . 0 0 0 . 0 0 . 0 . 0 0 . 802 . . . . 1 . . . . . . . . . . . . . . 920 . . . . . . 0 . . . . . . . . . . . . 1148 . . . 0 0 0 . . . . . . . . . . . . . 1242 . . 0 0 0 . 1 1 . . . . . . . . . . . 1327 . . 0 0 0 0 0 0 0 0 0 0 0 . 0 . 1 . . 1898 . . . . . . . . . . . . . . . . . . . 1981 . . . . . . . . . . . . . . . . . . . 2122 . . . 0 0 . . . . . . . . . . . . . . 2124 . . . . . . . . . . . . . . . . . . . 2127 . . . . . . . . . . . . . . . . . . . 2146 . . . . . . . 0 0 0 0 0 . 1 0 1 1 . . 2936 . 0 0 0 0 0 1 1 1 1 1 1 1 . . . . . . 3059 . . . . . . 1 . . . . . . . . . . . . 3101 . 0 0 0 0 0 0 1 1 1 1 1 1 . . . . . . 3192 . . . . . . 0 0 0 0 . 0 0 0 . . 0 . . 3485 . . . . . . . 0 0 . . . . . . . . . . 3760 . 0 . 0 1 1 1 1 1 . . . . . . . . . .
... View more