Dear Statalist users,
I have a question about a spell-dataset type. I am trying to merge survey data with the admin. dataset of respondents w.r.t. reported receipt of state benefits to investigate the extent of misreporting. There is test data for the latter dataset but not for the former; survey data offers no test data. The variable of interest in survey data is called hl0012 (1= Yes, benefit receipt, 2=No, -1=missing). And I would compare both sources based on the survey year in the survey dataset that is called (syear) and captures only the year in which the survey was conducted and respondents were asked. The spell variable is more detailed that reflects a date as shown in the ex. below.
My first question is how to best compare both givens in the two datasets using a dummy variable that would allow for cross-tabulation. And should I split the spells that stretch over multiple years for an individual or leave the episodes as given in the original data (there is a code suggested for this episode splitting that I have and creates span_year "Number of years spanned by the spell")? Ideally, the below example should be adjusted to include syear and the receipt dummy variable. My sequence of work in actual data is as follows, I started with the admin. data side, then merged the survey data and kept data if matched==3. I wanted initially to see the extent of misreporting for two survey years, however could be seen also for the entire given period.
clear
input long persnr byte(spell quelle) int(begepi endepi begorig endorig)
457031 12 16 16437 16538 16437 17166
457031 14 16 16539 16696 16437 17166
457031 17 16 16697 17011 16437 17166
457031 20 16 17012 17166 16437 17166
457031 23 16 17167 17409 17167 17409
457149 20 16 16437 16719 16437 17166
457149 22 16 16720 17166 16437 17166
457149 24 16 17167 17324 17167 17488
457149 26 16 17325 17395 17167 17488
457149 28 16 17396 17488 17167 17488
457149 30 16 17489 17903 17489 17903
457186 2 16 16607 16694 16607 16728
457186 4 16 16695 16728 16607 16728
457229 3 16 17442 17484 17442 17484
457229 5 16 17485 17573 17485 18785
457229 8 16 17574 17795 17485 18785
457229 11 16 17796 17897 17485 18785
457229 14 16 17898 17943 17485 18785
457229 17 16 17944 18216 17485 18785
457229 20 16 18217 18262 17485 18785
457229 23 16 18263 18489 17485 18785
457229 25 16 18490 18785 17485 18785
457333 20 16 16437 16477 16437 16477
457340 39 16 18723 18780 18723 18975
457340 41 16 18781 18942 18723 18975
457340 44 16 18943 18975 18723 18975
457516 3 16 16437 16895 16437 17166
457516 5 16 16896 17112 16437 17166
457516 7 16 17113 17166 16437 17166
457516 9 16 17167 17297 17167 17475
457516 12 16 17298 17475 17167 17475
457516 15 16 17476 17499 17476 17499
457516 18 16 17500 17531 17500 18585
457516 21 16 17532 17897 17500 18585
457516 24 16 17898 18262 17500 18585
457516 27 16 18263 18585 17500 18585
457516 30 16 18586 18613 18586 18932
457516 33 16 18614 18627 18586 18932
457516 34 16 18614 18627 18614 18851
457516 36 16 18628 18851 18586 18932
457516 37 16 18628 18851 18614 18851
457516 39 16 18852 18932 18586 18932
457679 1 16 16492 16605 16492 16605
457679 2 16 16606 16701 16606 16710
457679 4 16 16702 16710 16606 16710
457679 6 16 16711 16863 16711 16863
457679 8 16 16864 16867 16864 16991
457679 10 16 16868 16991 16864 16991
457679 12 16 16992 17148 16992 17148
457679 14 16 17149 17166 17149 17166
457679 16 16 17167 17972 17167 17972
457679 18 16 17973 17975 17973 17975
457679 22 16 18092 18384 18092 18384
457679 24 16 18385 18627 18385 18627
457720 5 16 17025 17058 17025 17166
457720 8 16 17059 17166 17025 17166
457720 11 16 17167 17177 17167 17177
457720 16 16 17295 17360 17295 17360
457727 26 16 16437 16586 16437 16875
457727 28 16 16587 16661 16437 16875
457727 31 16 16662 16789 16437 16875
457727 33 16 16790 16875 16437 16875
457847 17 16 16581 16712 16581 16809
457847 19 16 16713 16722 16581 16809
457847 22 16 16723 16753 16581 16809
457847 24 16 16754 16780 16581 16809
457847 26 16 16781 16788 16581 16809
457847 28 16 16789 16809 16581 16809
457847 30 16 16810 16814 16810 16814
457847 32 16 16815 17060 16815 17060
457847 34 16 17061 17073 17061 17073
457847 36 16 17074 17166 17074 17166
457847 38 16 17167 17685 17167 17992
457847 40 16 17686 17746 17167 17992
457847 42 16 17747 17992 17167 17992
457847 45 16 18272 18504 18272 18504
457866 13 16 17287 17336 17287 17522
457866 15 16 17337 17479 17287 17522
457866 17 16 17480 17492 17287 17522
457866 19 16 17493 17522 17287 17522
457866 21 16 17523 17612 17523 17622
457866 24 16 17613 17622 17523 17622
457873 11 16 17194 17200 17194 17415
457873 13 16 17201 17207 17194 17415
457873 15 16 17208 17213 17194 17415
457873 17 16 17214 17269 17194 17415
457873 19 16 17270 17275 17194 17415
457873 21 16 17276 17415 17194 17415
457873 23 16 17416 17438 17416 17438
457873 24 16 17439 17507 17439 17522
457873 26 16 17508 17522 17439 17522
458028 11 16 16520 16557 16520 16557
458028 13 16 16558 17062 16558 17166
458028 15 16 17063 17166 16558 17166
458028 17 16 17167 17639 17167 18238
458028 19 16 17640 17662 17167 18238
458028 21 16 17663 17704 17167 18238
458028 23 16 17705 17787 17167 18238
458028 25 16 17788 17877 17167 18238
458028 27 16 17878 17901 17167 18238
end
format %tdD_m_CY begepi
format %tdD_m_CY endepi
format %tdD_m_CY begorig
format %tdD_m_CY endorig
label values quelle quelle_de
label def quelle_de 16 "16 benefit receipt", modify
label values begorig miss_de
label values endorig miss_de
where:
Episode start date (begepi) & Episode end date (endepi) & Observation counter per person (spell)
begorig: The original start date of the observation corresponds to the original start date of the notification.
endorig: The original end date of the notification
[/CODE]
Thank you in advance!
I have a question about a spell-dataset type. I am trying to merge survey data with the admin. dataset of respondents w.r.t. reported receipt of state benefits to investigate the extent of misreporting. There is test data for the latter dataset but not for the former; survey data offers no test data. The variable of interest in survey data is called hl0012 (1= Yes, benefit receipt, 2=No, -1=missing). And I would compare both sources based on the survey year in the survey dataset that is called (syear) and captures only the year in which the survey was conducted and respondents were asked. The spell variable is more detailed that reflects a date as shown in the ex. below.
My first question is how to best compare both givens in the two datasets using a dummy variable that would allow for cross-tabulation. And should I split the spells that stretch over multiple years for an individual or leave the episodes as given in the original data (there is a code suggested for this episode splitting that I have and creates span_year "Number of years spanned by the spell")? Ideally, the below example should be adjusted to include syear and the receipt dummy variable. My sequence of work in actual data is as follows, I started with the admin. data side, then merged the survey data and kept data if matched==3. I wanted initially to see the extent of misreporting for two survey years, however could be seen also for the entire given period.
clear
input long persnr byte(spell quelle) int(begepi endepi begorig endorig)
457031 12 16 16437 16538 16437 17166
457031 14 16 16539 16696 16437 17166
457031 17 16 16697 17011 16437 17166
457031 20 16 17012 17166 16437 17166
457031 23 16 17167 17409 17167 17409
457149 20 16 16437 16719 16437 17166
457149 22 16 16720 17166 16437 17166
457149 24 16 17167 17324 17167 17488
457149 26 16 17325 17395 17167 17488
457149 28 16 17396 17488 17167 17488
457149 30 16 17489 17903 17489 17903
457186 2 16 16607 16694 16607 16728
457186 4 16 16695 16728 16607 16728
457229 3 16 17442 17484 17442 17484
457229 5 16 17485 17573 17485 18785
457229 8 16 17574 17795 17485 18785
457229 11 16 17796 17897 17485 18785
457229 14 16 17898 17943 17485 18785
457229 17 16 17944 18216 17485 18785
457229 20 16 18217 18262 17485 18785
457229 23 16 18263 18489 17485 18785
457229 25 16 18490 18785 17485 18785
457333 20 16 16437 16477 16437 16477
457340 39 16 18723 18780 18723 18975
457340 41 16 18781 18942 18723 18975
457340 44 16 18943 18975 18723 18975
457516 3 16 16437 16895 16437 17166
457516 5 16 16896 17112 16437 17166
457516 7 16 17113 17166 16437 17166
457516 9 16 17167 17297 17167 17475
457516 12 16 17298 17475 17167 17475
457516 15 16 17476 17499 17476 17499
457516 18 16 17500 17531 17500 18585
457516 21 16 17532 17897 17500 18585
457516 24 16 17898 18262 17500 18585
457516 27 16 18263 18585 17500 18585
457516 30 16 18586 18613 18586 18932
457516 33 16 18614 18627 18586 18932
457516 34 16 18614 18627 18614 18851
457516 36 16 18628 18851 18586 18932
457516 37 16 18628 18851 18614 18851
457516 39 16 18852 18932 18586 18932
457679 1 16 16492 16605 16492 16605
457679 2 16 16606 16701 16606 16710
457679 4 16 16702 16710 16606 16710
457679 6 16 16711 16863 16711 16863
457679 8 16 16864 16867 16864 16991
457679 10 16 16868 16991 16864 16991
457679 12 16 16992 17148 16992 17148
457679 14 16 17149 17166 17149 17166
457679 16 16 17167 17972 17167 17972
457679 18 16 17973 17975 17973 17975
457679 22 16 18092 18384 18092 18384
457679 24 16 18385 18627 18385 18627
457720 5 16 17025 17058 17025 17166
457720 8 16 17059 17166 17025 17166
457720 11 16 17167 17177 17167 17177
457720 16 16 17295 17360 17295 17360
457727 26 16 16437 16586 16437 16875
457727 28 16 16587 16661 16437 16875
457727 31 16 16662 16789 16437 16875
457727 33 16 16790 16875 16437 16875
457847 17 16 16581 16712 16581 16809
457847 19 16 16713 16722 16581 16809
457847 22 16 16723 16753 16581 16809
457847 24 16 16754 16780 16581 16809
457847 26 16 16781 16788 16581 16809
457847 28 16 16789 16809 16581 16809
457847 30 16 16810 16814 16810 16814
457847 32 16 16815 17060 16815 17060
457847 34 16 17061 17073 17061 17073
457847 36 16 17074 17166 17074 17166
457847 38 16 17167 17685 17167 17992
457847 40 16 17686 17746 17167 17992
457847 42 16 17747 17992 17167 17992
457847 45 16 18272 18504 18272 18504
457866 13 16 17287 17336 17287 17522
457866 15 16 17337 17479 17287 17522
457866 17 16 17480 17492 17287 17522
457866 19 16 17493 17522 17287 17522
457866 21 16 17523 17612 17523 17622
457866 24 16 17613 17622 17523 17622
457873 11 16 17194 17200 17194 17415
457873 13 16 17201 17207 17194 17415
457873 15 16 17208 17213 17194 17415
457873 17 16 17214 17269 17194 17415
457873 19 16 17270 17275 17194 17415
457873 21 16 17276 17415 17194 17415
457873 23 16 17416 17438 17416 17438
457873 24 16 17439 17507 17439 17522
457873 26 16 17508 17522 17439 17522
458028 11 16 16520 16557 16520 16557
458028 13 16 16558 17062 16558 17166
458028 15 16 17063 17166 16558 17166
458028 17 16 17167 17639 17167 18238
458028 19 16 17640 17662 17167 18238
458028 21 16 17663 17704 17167 18238
458028 23 16 17705 17787 17167 18238
458028 25 16 17788 17877 17167 18238
458028 27 16 17878 17901 17167 18238
end
format %tdD_m_CY begepi
format %tdD_m_CY endepi
format %tdD_m_CY begorig
format %tdD_m_CY endorig
label values quelle quelle_de
label def quelle_de 16 "16 benefit receipt", modify
label values begorig miss_de
label values endorig miss_de
where:
Episode start date (begepi) & Episode end date (endepi) & Observation counter per person (spell)
begorig: The original start date of the observation corresponds to the original start date of the notification.
endorig: The original end date of the notification
[/CODE]
Thank you in advance!
Comment