Hi, everyone! I was wondering if I could get some advice. I am working with the AHRQ's MEPS data, and I am stuck in trying to figure out how to shape (for the lack of a better word) my dataset into what I want. My data currently looks like this:
And I am trying to make a dataset in which all condidx associated with the dupersid is in one row (and just create a flag for a particular condition in my analysis that I am interested in). I have tried to reshape the data and have gotten errors in the many times I have tried to transform it. The more I look at it, the I know that I will not need multiple rounds of marital status, age, etc., but I thought I did when I was trying to clean it last week.
Any advice/guidance would be great. I've been trying to figure out this problem for for a while, and I thought that taking a week off from it would give me a fresh set of eyes, but I am back to where I started.
Thank you!
dupersid | condidx | icd9codx | cccodex | ccnum | … | female | rrace | … | marry1x | marry2x |
1 | 1 | 272 | 53 | 53 | … | Male(0) | White(0) | 1 MARRIED | 1 MARRIED | |
1 | 2 | 692 | 253 | 253 | … | Male(0) | White(0) | 1 MARRIED | 1 MARRIED | |
1 | 3 | 460 | 126 | 126 | … | Male(0) | White(0) | 1 MARRIED | 1 MARRIED | |
2 | 1 | 460 | 126 | 126 | … | Female(1) | White(0) | 1 MARRIED | 1 MARRIED | |
2 | 2 | 524 | 136 | 136 | … | Female(1) | White(0) | 1 MARRIED | 1 MARRIED | |
2 | 3 | 599 | 159 | 159 | … | Female(1) | White(0) | 1 MARRIED | 1 MARRIED | |
2 | 4 | 599 | 159 | 159 | … | Female(1) | White(0) | 1 MARRIED | 1 MARRIED | |
2 | 5 | 599 | 159 | 159 | … | Female(1) | White(0) | 1 MARRIED | 1 MARRIED |
Any advice/guidance would be great. I've been trying to figure out this problem for for a while, and I thought that taking a week off from it would give me a fresh set of eyes, but I am back to where I started.
Thank you!
Comment