Thanks a lot for all your effort. I added your code snippet in my code. We are almost there,,,, this code is taking most part of my datafile Except that, the below scenario has to be covered, data have; infile cards truncover; input PatientID Visit $ Medication reCalc; cards; 1 Visit1 111111 1 Visit2 222222 1 Visit2 33333 1 Visit3 . 1 1 Visit4 888888 12 Visit1 34343 12 Visit2 . 12 Visit2 . 12 Visit2 . 12 Visit4 . 1 12 Visit5 43333 12 Visit6 . 1 ; Please try this. When there are many null values, it is nit considering. Please help me with this as well.
... View more