Hi my dataset looks like this right now:
clear
input long mrn str10 date str11 diagnosis long date_n float(CAD CHF CKD CVA ESKD HLD HTN OSA obesity RAS T1DM T2DM tobacco)
1558 "9/13/2011" "CKD" 18883 . . 1 . . . . . . . . . .
1558 "9/28/2011" "ESKD" 18898 . . . . 1 . . . . . . . .
1558 "1/9/2018" "HLD" 21193 . . . . . 1 . . . . . . .
1558 "3/8/2012" "HTN" 19060 . . . . . . 1 . . . . . .
1558 "6/17/2013" "KTR" 19526 . . . . . . . . . . . . .
1558 "12/15/2012" "Obesity" 19342 . . . . . . . . 1 . . . .
1558 "6/11/2013" "T2DM" 19520 . . . . . . . . . . . 1 .
I wanted each mrn to have one row only. Right now they have multiple rows because the dates for different diagnosis are listed separately. Can I have the data look somewhat like this?
ID date CKD CAD CVA but only one row for each.
I hope I am able to make sense.
Please help me out I am new to STATA.
Ushma
Related Posts with Need help re-arranging data
CI Decmposition Results not Showing percentage contributionHi All, I am using Stata 16 and trying to decompose the concentration index but the results show no…
Flexible case-control matching commandHello, First, thanks in advance for anyone who can help me with this. I haven't had much luck recen…
Extract country names from affiliationsHi, I have a dataset of about 1000 articles with variables such as id, title, abstract and affiliat…
synth_runner automatically generated predictorvarsI am using synth_runner in STATA 17. I got the exact same results when I run two specifications. dep…
Working with Time and DateTime variables from ExcelHi, I noticed that whenever I import an excel file that contains a time or datetime variable onto S…
Subscribe to:
Post Comments (Atom)
0 Response to Need help re-arranging data
Post a Comment