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
How to create a categorical variable from a list?Hello members, I would like to seek your suggestion please on how best I can create a categorical v…
How to write a while statement for the purpose detailed in the post?Dear all, I have two variables: seq1 and u. seq1 is a repeating sequence: 1,2,3,4,5 u is a random …
Merging individuals and domicilesHi, Can somebody please advise me on the best way to merge information I have on individuals and the…
Linear Regression: Interpreting Continuous Interaction?Hi! I'm a beginner when it comes to both statistics and STATA. This question might be more of a sta…
Problem with count variable generationDear Statalist Users, Although I went through many related discussions and explanations about my qu…
Subscribe to:
Post Comments (Atom)
0 Response to Need help re-arranging data
Post a Comment