Hello all,
I have individual datasets that have four waves ( i_indresp j_indresp k_indresp l_indresp), and each wave represents almost a year. I append these four waves to get this data "Main survey" :
"Main survey" :
I would like to merge the above data, "Main survey" with the data "Covid_waves."
"Covid_waves" :
All these data are produced from the same institution. These are individual-level data, with each row uniquely identified by "PIDP". Therefore, The "Covid_waves" can be linked to the main survey individual data using "pidp"
However, I tried to merge the "Covid_data" to the " Main survey" by this code.
But I got this error: " variable pidp does not uniquely identify observations in the using data". I think this is not supposed to happen because the PIDP variable is unique for each individual. I'm not sure what is causing this problem is that my appending of the main survey waves was wrong or something else.
I have individual datasets that have four waves ( i_indresp j_indresp k_indresp l_indresp), and each wave represents almost a year. I append these four waves to get this data "Main survey" :
"Main survey" :
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double pidp long hidp int dvage byte jbstat float(wfh_always wfh_never) str1 wave int jbsoc10_cc 68004087 68006816 67 2 . . "i" -9 68006127 68013616 47 6 . . "i" -8 68020564 68013616 46 8 . . "i" -8 68006807 68034016 80 4 . . "i" -8 68008847 68040816 59 2 . . "i" -8 68009527 68047616 39 2 . . "i" 312 68061288 68047616 31 2 . . "i" 413 68010887 68054416 53 2 . . "i" 614 68068082 68054416 56 1 . . "i" -9 68011567 68061216 43 2 . . "i" 125 68020407 68095216 80 4 . . "i" -8 68028567 68108816 46 3 . . "i" 711 68028571 68108816 50 2 . . "i" 614 68028575 68129216 26 6 . . "i" -8 68157166 68129216 32 2 . . "i" 353 68029927 68136016 45 6 . . "i" -8 68029931 68136016 48 2 . . "i" 356 68031967 68142816 69 4 . . "i" -8 68035367 68156416 36 2 . . "i" 242 68142890 68156416 37 5 . . "i" 356 end label values dvage i_dvage label values jbstat i_jbstat label def i_jbstat 1 "Self employed", modify label def i_jbstat 2 "Paid employment(ft/pt)", modify label values jbsoc10_cc i_jbsoc10_cc label def i_jbsoc10_cc -9 "missing", modify label def i_jbsoc10_cc -8 "inapplicable", modify label def i_jbsoc10_cc 118 "Health and Social Services Managers and Directors", modify label def i_jbsoc10_cc 125 "Managers and Proprietors in Other Services", modify label def i_jbsoc10_cc 213 "Information Technology and Telecommunications Professionals", modify label def i_jbsoc10_cc 223 "Nursing and Midwifery Professionals", modify label def i_jbsoc10_cc 231 "Teaching and Educational Professionals", modify
I would like to merge the above data, "Main survey" with the data "Covid_waves."
"Covid_waves" :
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long pidp float(furloughed wfh_always wfh_never wfh_can) 76165 0 1 0 0 280165 1 0 1 0 469205 0 0 1 0 599765 0 1 0 0 732365 . 0 0 0 1587125 . 0 0 1 3424485 . 0 0 0 4849085 0 0 1 0 68008847 0 0 1 0 68010887 0 0 1 0 68031967 . 0 0 0 68035365 . 0 0 0 68035367 0 1 0 0 68041487 0 1 0 0 68041491 1 0 1 0 68042171 0 1 0 0 68044207 0 1 0 0 68045567 0 1 0 0 68046247 . 0 0 0 68046251 . 0 0 0 68051007 . 1 0 0 68051011 0 0 1 0 68056463 . 0 0 0 68058487 . 0 0 0 68058491 . 0 0 0 68060527 0 1 0 0 68060531 0 1 0 0 68060533 . 0 0 0 68060537 . 0 0 0 68061288 0 0 1 0 68063247 0 0 1 0 68063927 0 0 1 0 68063931 0 0 1 0 68064605 . 0 0 0 68064609 . 0 0 0 68068007 0 0 1 0 68068011 0 0 1 0 68068015 0 1 0 0 68068082 . 0 1 0 68071407 0 0 1 0 68076171 . 0 0 0 68097245 . 0 0 0 68097927 . 0 0 0 68106767 . 0 0 0 68111531 . 0 0 0 68112211 1 0 1 0 68120367 . 0 0 0 68120375 0 1 0 0 68121047 . 0 0 0 68125127 0 0 1 0 68125131 0 1 0 0 68125135 0 0 0 1 68133285 . 0 0 0 68133289 . 0 0 0 68136009 0 1 0 0 68137365 . 0 0 0 68138045 . 0 0 0 68138049 . 0 0 0 68138051 . 0 0 0 68141447 . 0 0 0 68142139 1 0 1 0 68142890 0 1 0 0 68144847 0 1 0 0 end
All these data are produced from the same institution. These are individual-level data, with each row uniquely identified by "PIDP". Therefore, The "Covid_waves" can be linked to the main survey individual data using "pidp"
However, I tried to merge the "Covid_data" to the " Main survey" by this code.
Code:
merge m:1 pidp using " Main survey"
Comment