** 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). define !path1 () 'h:\geode\workshop\practical\test1\' !enddefine. * Location for data to be input to GEODE client; and for output from client :. define !path2 () 'h:\temp\' !enddefine. **************************************************************************. ** Example 1 : BHPS 1991 extract (A) linked to Hakim gender segregation codes (1). get file=!path1+"bhps_w1_extract.sav". descriptives var=ajbsoc. ** Write out to plain text tab delimited: . * ( information on: http://www.geode.stir.ac.uk/file_convert_info.html ). save translate /outfile=!path2+"bhps_1.dat" /type=tab /fieldnames /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 :. get translate /file=!path2+"bhps_2.dat" /type=tab /fieldnames. descriptives var=ajbsoc genseg. ** Genseg is the new information :. missing values genseg (-999). graph /bar=mean(genseg) by sex by 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). get file=!path1+"lfs_2002extract.sav". descriptives var=soc2km ukempst. * cut out missing values :. recode soc2km ukempst (missing,sysmis=-999). missing values soc2km ukempst (-777). descriptives var=soc2km ukempst. ** This method is used to preserve value labels etc :. ** Define linking variables :. define !var1 () soc2km !enddefine. define !var2 () ukempst !enddefine. compute caseid=$casenum. sav out=!path2+"mtch1.sav". compute occ1= !var1 . compute occ2= !var2 . save translate /outfile=!path2+"lfs_1.dat" /type=tab / fieldnames /replace /keep=caseid occ1 occ2 . ** Input this to the GEODE occupational matching processor. * (using the G1 occupational information resource called 'gbsockkukempst'. ** Set it to output to the file : lfs_2.dat . get translate /file=!path2+"lfs_2.dat" /type=tab /fieldnames. sort cases by caseid. match files file=* /file=!path2+"mtch1.sav" /by=caseid. descriptives var=soc2km mcamsis. missing values mcamsis (-999). fre var=house. graph /bar=mean(mcamsis) by sex by house . * note that the value labels have been preserved (unlike example 1) . fre var=rgsc. graph /bar=mean(mcamsis) by sex by rgsc . *****************************************************************************************************.