I am hoping to get some advice on linking data between a spreadsheet that contains baseline (cross-sectional) parameters (master dataset) and a spreadsheet that contains longitudinal (outcome) data (using dataset), related to hospital encounters with admission date and ICD codes. Both data sheets have a column with a unique participant identifier.
The using dataset contains many rows with the same participant, given they had multiple hospital encounters.
As such, when I try to undertake ' merge m:1 varlist [id] using filename ' , it returns an error stating "variable varlist does not uniquely identify observations in the using data".
I have tried to troubleshoot this by performing ' reshape wide varlist [ICD code], i(varlist [id]) j(varlist [admission date]) ' but again return an error "variable varlist [admission date] takes on too many values.
Is there another way I can work this through such that I can merge my two data sheets so all hospital encounters with ICD codes and dates are included in the master dataset?
The using dataset contains many rows with the same participant, given they had multiple hospital encounters.
As such, when I try to undertake ' merge m:1 varlist [id] using filename ' , it returns an error stating "variable varlist does not uniquely identify observations in the using data".
I have tried to troubleshoot this by performing ' reshape wide varlist [ICD code], i(varlist [id]) j(varlist [admission date]) ' but again return an error "variable varlist [admission date] takes on too many values.
Is there another way I can work this through such that I can merge my two data sheets so all hospital encounters with ICD codes and dates are included in the master dataset?
Comment