Hi SAS Community. I have a dataset below that keeps track of patient's medications (mtx,ssz, lef, hcq, etn, etc) at each study encounter. The codes for the each med are 0=not currently taking, 1=currently taking, and 2= stopped med, and the medication doses all in mg. data have; infile datalines dsd truncover; input id:$11. enc:32. med_mtx:32. med_mtx_dose:32. med_ssz:32. med_ssz_dose:32. med_lef:32. med_lef_dose:32. med_hcq:32. med_hcq_dose:32. med_etn:32. med_etn_dose:32.; datalines4; 1016,1,0,,0,,0,,0,,0, 1016,2,,,,,,,,,, 1016,3,,,,,,,,,, 1016,4,,,,,,,,,, 1016,5,,,,,,,,,, 1017,1,0,,0,,0,,1,400,0, 1017,2,0,,0,,0,,1,,0, 1017,3,0,,0,,0,,1,400,0, 1017,4,0,,0,,0,,2,,0, 1017,5,,,,,,,,,, 1018,1,0,,0,,1,20,0,,0, 1018,2,,,,,,,,,, 1018,3,,,,,,,,,, 1018,4,,,,,,,,,, 1018,5,,,,,,,,,, 1023,1,1,20,0,,0,,0,,0, 1023,2,,,,,,,,,, 1023,3,,,,,,,,,, 1023,4,,,,,,,,,, 1023,5,,,,,,,,,, 1024,1,0,,0,,0,,0,,0, 1024,2,,,,,,,,,, 1024,3,,,,,,,,,, 1024,4,,,,,,,,,, 1024,5,,,,,,,,,, 1025,1,0,,0,,1,20,0,,0, 1025,2,,,,,,,,,, 1025,3,,,,,,,,,, 1025,4,0,,1,2000,1,20,0,,0, 1025,5,,,,,,,,,, 1026,1,0,,0,,1,20,1,400,0, 1026,2,,,,,,,,,, 1026,3,0,,0,,1,20,1,400,0, 1026,4,0,,0,,1,20,1,200,0, 1026,5,,,,,,,,,, 1028,1,0,,0,,0,,0,,0, 1028,2,0,,0,,0,,0,,0, 1028,3,0,,0,,0,,0,,0, 1028,4,0,,0,,0,,0,,0, 1028,5,,,,,,,,,, 1029,1,1,25,0,,0,,0,,1,50 1029,2,,,,,,,,,, 1029,3,1,25,1,2000,0,,0,,2, 1029,4,,,,,,,,,, 1029,5,,,,,,,,,, ;;;; I would like to add a note/text column that summarizes the change in medcations at each encounter by comparing the current meds to the meds at the previous encounters. The note column needs to show the current meds and the doses, med stopped, and new meds added, like this: Your help is greatly appreciated!
... View more