Hello all
I've monthly cross-sectional data - only for some months for 2020 and 2021( April 2020, May 2020, June 2020, July 2020, Sep 2020, Nov 2020, Jan 2021, March 2021, and Sep 2021). I would like to convert the data to yearly. Is this possible with keeping the variable "wah" is a categorical variable because this is my interest variable and needs to be a categorical variable, not a mean
I want to convert to yearly because I have other data from 2019 to 2021 yearly, and I need to merge both datasets. I think the best way to merge these two datasets is by converting the monthly to yearly and merging them. Can my idea work? If not, could you please suggest any way to merge both data?
I will provide a sample of both data in a wide format :
Monthly data :
Yearly data :
I've monthly cross-sectional data - only for some months for 2020 and 2021( April 2020, May 2020, June 2020, July 2020, Sep 2020, Nov 2020, Jan 2021, March 2021, and Sep 2021). I would like to convert the data to yearly. Is this possible with keeping the variable "wah" is a categorical variable because this is my interest variable and needs to be a categorical variable, not a mean
I want to convert to yearly because I have other data from 2019 to 2021 yearly, and I need to merge both datasets. I think the best way to merge these two datasets is by converting the monthly to yearly and merging them. Can my idea work? If not, could you please suggest any way to merge both data?
I will provide a sample of both data in a wide format :
Monthly data :
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long pidp byte(ca_wah cb_wah cc_wah cd_wah ce_wah cf_wah cg_wah ch_wah ci_wah) 76165 1 1 1 1 1 1 1 1 3 280165 4 4 4 4 4 . . . . 469205 4 . . . 4 . . . 4 599765 1 1 1 . . . . . -8 732365 -8 -8 -8 . -8 -8 -8 -8 -8 1587125 3 2 2 2 2 3 3 3 3 3424485 -8 -8 . . . . . -8 -8 4849085 4 3 2 3 3 2 1 1 2 68002725 . -8 -8 -8 -8 -8 -8 -8 -8 68008847 4 . -8 4 4 4 4 4 4 68010887 4 4 4 4 3 3 2 2 . 68029931 . . . 1 . . 1 . . 68031967 -8 -8 -8 -8 -8 -8 -8 -8 . 68035365 -8 -8 -8 -8 -8 -8 -8 -8 -8 68035367 1 1 2 3 3 2 2 2 2 68037411 . -8 4 . . . . . . 68041487 1 1 1 1 1 1 1 1 1 68041491 4 -8 4 . . . 1 . 2 68042171 1 . . . . . . . . 68044207 1 . . . . . . . . 68045567 1 1 1 1 1 1 1 1 1 68046247 -8 -8 -8 -8 -8 -8 -8 -8 -8 68046251 -8 -8 -8 -8 -8 -8 -8 -8 -8 68051007 1 2 1 1 1 1 2 1 1 68051011 4 4 4 4 4 4 4 4 4 68056463 -8 . . . . . . . . 68058487 -8 -8 -8 -8 -8 -8 -8 -8 -8 68058491 -8 -8 -8 -8 -8 -8 -8 -8 -8 68060527 1 1 1 . . 1 . . . 68060531 1 1 1 1 1 1 1 1 1 68060533 -8 -8 -8 -8 -8 -8 -8 -8 -8 68060537 -8 -8 -8 -8 -8 . -8 -8 -8 68061288 4 4 4 . 4 4 . . . 68063247 4 4 4 4 4 4 4 4 4 68063927 4 4 4 4 4 4 4 4 4 68063931 4 4 4 . 4 . 4 4 4 68064605 -8 -8 -8 -8 -8 -8 -8 -8 -8 68064609 -8 -8 -8 -8 -8 -8 -8 -8 -8 68068007 4 4 4 4 4 4 4 4 4 68068011 4 4 4 4 4 4 . 4 4 68068015 1 1 1 1 . 1 . . 4 68068082 4 4 3 3 3 4 4 4 . 68071407 4 . . . . . . . . 68076171 -8 . . . . . . . . 68091139 . -8 -8 -8 . -8 . . . 68097245 -8 -8 -8 -8 -8 -8 -8 -8 -8 68097927 -8 -8 -8 -8 -8 -8 -8 -8 -8 68106767 -8 . . . . . . . . 68111531 -8 . . . . . . 2 2 68112211 4 3 2 2 3 3 . 3 2 68120367 -8 -8 -8 -8 -8 -8 -8 -8 -8 68120375 1 1 2 2 2 3 1 2 3 68121047 -8 . . . . . . . -8 68125127 4 4 4 4 4 4 4 4 4 68125131 1 1 1 1 2 -8 2 2 . 68125135 3 3 2 3 3 4 3 4 2 68131931 . -8 . . . . . . . 68133285 -8 -8 -8 -8 -8 -8 -8 -8 -8 68133289 -8 -8 -8 -8 -8 -8 -8 -8 -8 68136009 1 1 1 1 1 . 1 1 1 68137365 -8 -8 -8 -8 -8 -8 -8 -8 -8 68138045 -8 -8 -8 -8 -8 -8 -8 -8 -8 68138049 -8 -8 -8 -8 -8 . -8 -8 -8 68138051 -8 -8 -8 -8 -8 -8 -8 -8 -8 68141447 -8 . . . . . . -8 . 68142139 4 . . . . . . . . 68142890 1 3 . . . . . 1 2 68144847 1 1 1 1 1 1 1 1 1 68144851 1 1 2 2 2 -8 -8 -8 -8 68148247 -8 -8 -8 -8 -8 -8 -8 -8 -8 68148251 -8 -8 -8 -8 -8 -8 . -8 . 68150967 4 4 4 4 4 4 . 4 4 68150971 1 1 1 1 1 1 1 1 1 68150975 1 1 1 1 1 1 1 1 1 68155047 -8 -8 -8 -8 -8 -8 -8 . . 68155051 2 2 4 4 4 3 -8 -8 . 68155055 4 4 4 . . . . . . 68155727 4 . 4 . . 4 . 4 4 68155731 1 1 . 1 . . . . 4 68157166 1 . . . . . . . . 68157767 1 4 . . . . . . . 68157771 1 . . . 1 1 1 1 1 68159131 3 4 4 3 3 3 2 2 2 68160485 4 4 4 4 4 4 4 4 4 68160489 1 1 1 1 1 . 1 1 2 68163887 -8 . . . . . . . . 68173407 -8 -8 -8 -8 -8 -8 -8 -8 -8 68174767 -8 . . -8 -8 -8 . . -8 68180887 4 3 4 4 4 4 4 4 4 68180891 1 1 1 1 1 1 . 1 . 68180895 4 . 4 4 . -8 . . 4 68184967 2 . . 1 . . . . -8 68184971 4 4 4 4 . . 1 1 4 68185647 -8 -8 -8 -8 -8 -8 -8 -8 -8 68187687 -8 -8 -8 -8 -8 -8 -8 -8 -8 68187691 -8 -8 -8 -8 -8 -8 -8 -8 -8 68188367 3 3 3 4 4 4 3 3 3 68191771 1 1 1 1 1 1 1 1 1 68193127 -8 -8 -8 -8 -8 -8 -8 -8 -8 68193131 . . . -8 . . . . . end label values ca_wah ca_wah label def ca_wah -8 "inapplicable", modify label def ca_wah 1 "Always", modify label def ca_wah 2 "Often", modify label def ca_wah 3 "Sometimes", modify label def ca_wah 4 "Never", modify label values cb_wah cb_wah label def cb_wah -8 "Inapplicable", modify label def cb_wah 1 "Always", modify label def cb_wah 2 "Often", modify label def cb_wah 3 "Sometimes", modify label def cb_wah 4 "Never", modify label values cc_wah cc_wah label def cc_wah -8 "Inapplicable", modify label def cc_wah 1 "Always", modify label def cc_wah 2 "Often", modify label def cc_wah 3 "Sometimes", modify label def cc_wah 4 "Never", modify label values cd_wah cd_wah label def cd_wah -8 "Inapplicable", modify label def cd_wah 1 "Always", modify label def cd_wah 2 "Often", modify label def cd_wah 3 "Sometimes", modify label def cd_wah 4 "Never", modify label values ce_wah ce_wah label def ce_wah -8 "inapplicable", modify label def ce_wah 1 "Always", modify label def ce_wah 2 "Often", modify label def ce_wah 3 "Sometimes", modify label def ce_wah 4 "Never", modify label values cf_wah cf_wah label def cf_wah -8 "inapplicable", modify label def cf_wah 1 "Always", modify label def cf_wah 2 "Often", modify label def cf_wah 3 "Sometimes", modify label def cf_wah 4 "Never", modify label values cg_wah cg_wah label def cg_wah -8 "inapplicable", modify label def cg_wah 1 "Always", modify label def cg_wah 2 "Often", modify label def cg_wah 3 "Sometimes", modify label def cg_wah 4 "Never", modify label values ch_wah ch_wah label def ch_wah -8 "inapplicable", modify label def ch_wah 1 "Always", modify label def ch_wah 2 "Often", modify label def ch_wah 3 "Sometimes", modify label def ch_wah 4 "Never", modify label values ci_wah ci_wah label def ci_wah -8 "inapplicable", modify label def ci_wah 1 "Always", modify label def ci_wah 2 "Often", modify label def ci_wah 3 "Sometimes", modify label def ci_wah 4 "Never", modify
Yearly data :
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double pidp int j_dvage byte j_jbsat double j_jbhrs int l_jbsoc10_cc 22445 33 6 30 -8 29925 41 7 23 415 76165 35 5 35 313 280165 39 5 40 -8 333205 28 6 40 . 469205 28 7 16 623 599765 31 6 36.5 113 665045 36 4 15 543 732365 33 -8 -8 -8 760925 37 -8 -8 . 1587125 52 3 -8 244 1697285 45 5 37.5 . 2626845 40 -7 35 . 2888645 29 6 38 -8 3229325 49 -8 -8 . 3424485 82 -7 -8 -8 3667245 30 7 40 . 3705325 64 -8 -8 -8 3914085 . . . . 3914765 . . . . 3916125 . . . . 4454005 73 -8 -8 -8 4849085 35 1 37.5 113 4853165 48 6 37 511 68002725 64 -8 -8 -8 68004087 68 -8 -8 . 68006127 48 -8 -8 . 68008847 60 7 39 415 68009527 40 4 36.5 312 68010887 54 6 32 614 68011567 44 6 37.5 . 68014287 49 -8 -8 . 68014291 25 6 35 . 68014295 18 -8 -8 . 68020407 81 -8 -8 . 68020564 47 -8 -8 . 68021765 59 7 30 . 68021781 24 6 35 . 68028575 27 -8 -8 -8 68029927 46 -8 -8 -8 68029931 49 7 37 . 68029935 . . . . 68031967 70 -8 -8 -8 68035365 66 -8 -8 -8 68035367 37 6 37 242 68036727 86 -8 -8 -8 68037407 49 6 37.5 813 68037411 19 5 37 . 68041487 48 6 37 354 68041491 44 6 40 -8 68041495 17 -8 -8 . 68041499 . . . . 68042167 48 3 37 231 68042171 47 6 40 231 68043527 64 -8 -8 -8 68044207 42 4 21 -9 68044211 45 6 -8 -9 68044887 71 -8 -8 -8 68045567 56 6 37 118 68045571 58 -8 -8 -8 68046247 75 -8 -8 -8 68046251 73 -8 -8 -8 68046927 45 6 37 . 68046935 18 4 12 . 68049647 60 6 35 231 68049651 58 4 38 411 68051007 57 2 37.5 212 68051011 50 6 37.5 223 68056447 55 4 30 -9 68056451 53 -8 -8 923 68056455 23 1 32.5 356 68056459 18 -8 -8 -8 68056463 . . . 911 68058485 73 -8 -8 -8 68058487 78 -8 -8 -8 68058489 73 -8 -8 -8 68058491 69 -8 -8 -8 68059171 28 4 -8 . 68060525 91 -8 -8 . 68060527 44 6 37 356 68060531 45 5 37 -9 68060533 62 5 15 . 68060537 74 -8 -8 . 68061288 32 5 22.5 711 68063247 51 -8 -8 923 68063251 53 7 39 822 68063255 18 -8 -8 924 68063927 48 6 30 223 68063931 50 4 40 614 68064605 69 -8 -8 -8 68064609 66 -8 -8 -8 68068007 51 -8 -8 913 68068011 51 3 30 -9 68068015 26 -8 -8 354 68068019 21 7 37.5 . 68068082 . . . -9 68069367 90 -8 -8 -8 68071407 29 2 40 544 68072087 64 -8 -8 -8 68076167 69 -8 -8 -8 end label values j_dvage j_dvage label values j_jbsat j_jbsat label def j_jbsat -8 "inapplicable", modify label def j_jbsat -7 "proxy", modify label def j_jbsat 1 "completely dissatisfied", modify label def j_jbsat 2 "mostly dissatisfied", modify label def j_jbsat 3 "somewhat dissatisfied", modify label def j_jbsat 4 "neither satisfied or dissatisfied", modify label def j_jbsat 5 "somewhat satisfied", modify label def j_jbsat 6 "mostly satisfied", modify label def j_jbsat 7 "completely satisfied", modify label values j_jbhrs j_jbhrs label def j_jbhrs -8 "inapplicable", modify label values l_jbsoc10_cc l_jbsoc10_cc label def l_jbsoc10_cc -9 "missing", modify label def l_jbsoc10_cc -8 "inapplicable", modify label def l_jbsoc10_cc 113 "Functional Managers and Directors", modify label def l_jbsoc10_cc 118 "Health and Social Services Managers and Directors", modify label def l_jbsoc10_cc 212 "Engineering Professionals", modify label def l_jbsoc10_cc 223 "Nursing and Midwifery Professionals", modify label def l_jbsoc10_cc 231 "Teaching and Educational Professionals", modify label def l_jbsoc10_cc 242 "Business, Research and Administrative Professionals", modify label def l_jbsoc10_cc 244 "Welfare Professionals", modify label def l_jbsoc10_cc 312 "Draughtspersons and Related Architectural Technicians", modify label def l_jbsoc10_cc 313 "Information Technology Technicians", modify label def l_jbsoc10_cc 354 "Sales, Marketing and Related Associate Professionals", modify label def l_jbsoc10_cc 356 "Public Services and Other Associate Professionals", modify label def l_jbsoc10_cc 411 "Administrative Occupations: Government and Related Organisations", modify label def l_jbsoc10_cc 415 "Other Administrative Occupations", modify
Comment