* GEODE workshop, 16th January . ** File matching exercises (practical exercises 4 and 5). **************************************************************************. * Location of workshop files (from http://www.geode.stir.ac.uk/workshop/data/*.sav). global path1 "h:\geode\workshop\practical\test1\" * Location for data to be input to GEODE client; and for output from client :. global path2 "h:\temp\" **************************************************************************. ** Example 1 : BHPS 1991 extract (A) linked to Hakim gender segregation codes (1). use $path1\bhps_w1_extract.dta, clear summarize ajbsoc ** Write out to plain text tab delimited: . * ( information on: http://www.geode.stir.ac.uk/file_convert_info.html ). outsheet using $path2\bh_1.dat, nolabel replace ** Input this to the GEODE occupational matching processor. * (using the G1 occupational information resource called 'hakimsoc'. ** Set it to output to the file : bhps_2.dat . ** Read in the newly created data file :. insheet using $path2\bh_2.dat, clear summarize ajbsoc genseg ** Genseg is the new information :. mvdecode genseg, mv(-999) graph bar (mean) genseg , asyvars over(sex) over(ukempst) * (http://www.geode.stir.ac.uk/ougs.html#ukempst ). * note that the value labels have been lost by exporting the full file to plain text - cf example 2. *****************************************************************************************************. ** Example 2 : LFS 2002 extract (A) linked to CAMSIS scores (2). use $path1\lfs_2002extract.dta, clear summarize soc2km ukempst * cut out missing values :. mvencode soc2km, mv(-999) mvencode ukempst, mv(-999) summarize soc2km ukempst ** ** This method is used to preserve value labels etc :. ** Define linking variables :. global var1 "soc2km" global var2 "ukempst" gen caseid= _n sort caseid save $path2\mtch1.dta, replace gen occ1= $var1 gen occ2= $var2 * Stage (1). keep caseid occ1 occ2 outsheet using $path2\l_1.dat, nolabel replace ** Input this to the GEODE occupational matching processor. * (using the G1 occupational information resource called 'gbsockkukempst'. ** Set it to output to the file : l_2.dat . insheet using $path2\l_2.dat, clear sort caseid merge caseid using $path2\mtch1.dta drop _merge summarize summarize mcamsis mvdecode mcamsis, mv(-999) tab house tab sex graph bar (mean) mcamsis , asyvars over(sex) over(house) * note that the value labels have been preserved (unlike example 1) . tab rgsc graph bar (mean) mcamsis , asyvars over(sex) over(rgsc) * (but the rgsc codes need to be added in still) *****************************************************************************************************.