Hello everyone,

I am dealing with a large national database (TQIP) which has a series of variables (ICD and AIS codes) stored in long datasets such as:

inc_key icdprocedurecode icdprocedurecode_biu icdprocedureversion proceduremins proceduredays
1.800e+11 BW28ZZZ ICD10 145 1
1.800e+11 B030ZZZ ICD10 3149 3
1.800e+11 BR29ZZZ ICD10 165 1
1.800e+11 BW251ZZ ICD10 151 1
1.800e+11 BR20ZZZ ICD10 161 1
1.800e+11 BR27ZZZ ICD10 164 1
1.800e+11 BR29ZZZ ICD10 10 1

1.900e+11 BW28ZZZ ICD10 9 1
1.900e+11 BR20ZZZ ICD10 9 1
1.900e+11 BW25YZZ ICD10 10 1
1.900e+11 BW40ZZZ ICD10 5 1
1.900e+11 BR27ZZZ ICD10 10 1
1.900e+11 0HQ0XZZ ICD10 40 1
1.900e+11 BW28ZZZ ICD10 30 1
1.900e+11 B24CZZZ ICD10 1

Essentially, I have one common variable i (inc_key) to use in reshape but there is no unique j variable to use with reshape such as year or numbering of any kind since the order of the ICD 10 codes does not matter for this analysis-- I just need them separated and categorized into a single inc_key number for each (so icdcode1, icdcode2, etc. for each unique inc_key number), but I'm not sure how to do this.

I hope this wasn't confusing.