clear set mem 500m /* File: cepr_basic_read_all.do Date: Nov 21, 2006 Desc: Retrieves raw CPS Basic data and adds data labels */ /*Windows vs. GNU/Linux*/ global gnulin = 1 /*Set gnulin=0 if you run Windows; 1 if GNU/Linux*/ if $gnulin==1 { /*directories*/ global locbdo "/ceprdata/CPS_Basic/CEPR/DoFiles" global locbas "/ceprdata/CPS_Basic/NBER" /*executables*/ global gzip "/usr/bin/gzip" global copy "/bin/cp" global erase "/bin/rm" } if $gnulin==0 { /*directories*/ global locbdo "F:\DATA\CPS_Basic\CEPR\DoFiles" global locbas "F:\DATA\CPS_Basic\NBER" /*executables*/ global gzip "F:\Software\Gzip\gzip.exe" global copy "copy" global erase "erase" } /* 2003 */ capture program drop b2003 program define b2003 local i=1 while `i'<=12 { cd $locbas cd 2003 !$gzip -d cpsb_2003_`i'.txt.gz !$copy cpsb_2003_`i'.txt cpsb2003.txt cd $locbdo do cps_basic_read_2003.do gen int year=2003 compress cd $locbas cd 2003 save cps_basic_raw_2003_`i'.dta, replace !$gzip -vN cpsb_2003_`i'.txt /* recompress */ !$erase cpsb2003.txt local i=`i'+1 } /* loop through months */ end /* from May 2004, the CPS changed coding of sub-state geographic areas; the change has no effect on the current version of the CEPR CPS ORG and BASIC CPS extracts, which do not provide consistent versions of sub-state geographic areas; in all other respects, the raw CPS data were unchanged, allowing continued use of Jan 2003 coding for data from May 2004 */ /* 2004 */ capture program drop b2004 program define b2004 local i=1 while `i'<=12 { cd $locbas cd 2004 !$gzip -d cpsb_2004_`i'.txt.gz /* use Jan 2003 coding, even after May 2004: */ /* 2004 uses Jan 2003 coding */ if $gnulin==1 { !$copy cpsb_2004_`i'.txt "$locbas/2003/cpsb2003.txt" } if $gnulin==0 { !$copy cpsb_2004_`i'.txt "$locbas\2003\cpsb2003.txt" } cd $locbdo do cps_basic_read_2003.do /* uses Jan 2003 coding */ gen int year=2004 compress cd $locbas cd 2004 save cps_basic_raw_2004_`i'.dta, replace !$gzip -vN cpsb_2004_`i'.txt /* recompress */ cd $locbas cd 2003 !$erase cpsb2003.txt /* 2004 uses Jan 2003 coding */ local i=`i'+1 } /* loop through months */ end /* in August 2005, BLS/Census introduced a new data dictionary */ /* 2005 */ capture program drop b2005 program define b2005 local i=1 while `i'<=12 { cd $locbas cd 2005 if `i'<=7 { /* Jan-Jul 2005 */ !$gzip -d cpsb_2005_`i'.txt.gz /* use Jan 2003 coding, even after May 2004: */ /* 2005 uses Jan 2003 coding */ if $gnulin==1 { !$copy cpsb_2005_`i'.txt "$locbas/2003/cpsb2003.txt" } if $gnulin==0 { !$copy cpsb_2005_`i'.txt "$locbas\2003\cpsb2003.txt" } cd $locbdo do cps_basic_read_2003.do /* uses Jan 2003 coding */ gen int year=2005 cd $locbas cd 2005 save cps_basic_raw_2005_`i'.dta, replace !$gzip -vN cpsb_2005_`i'.txt /* recompress */ cd $locbas cd 2003 !$erase cpsb2003.txt } /* Jan-Jul 2005 */ if 8<=`i' & `i'<=12 { /* Aug-Sep 2005 */ cd $locbas cd 2005 !$gzip -d cpsb_2005_`i'.txt.gz !$copy cpsb_2005_`i'.txt cpsb2005.txt cd $locbdo do cps_basic_read_2005.do /* from Aug 2005 */ gen int year=2005 compress cd $locbas cd 2005 save cps_basic_raw_2005_`i'.dta, replace !$gzip -vN cpsb_2005_`i'.txt /* recompress */ !$erase cpsb2005.txt } /* Aug-Sep 2005 */ local i=`i'+1 } /* loop through months */ end /* 2006 */ capture program drop b2006 program define b2006 local i=1 while `i'<=12 { /* Jan-Dec 2006 */ if 1<=`i' & `i'<=12 { /* Jan-Dec 2006 */ cd $locbas cd 2006 !$gzip -d cpsb_2006_`i'.txt.gz /* use Aug 2005 coding for Jan-Dec 2006*/ if $gnulin==1 { !$copy cpsb_2006_`i'.txt "$locbas/2005/cpsb2005.txt" } if $gnulin==0 { !$copy cpsb_2006_`i'.txt "$locbas\2005\cpsb2005.txt" } cd $locbdo do cps_basic_read_2005.do /* from Aug 2005 */ gen int year=2006 compress cd $locbas cd 2006 save cps_basic_raw_2006_`i'.dta, replace !$gzip -vN cpsb_2006_`i'.txt /* recompress */ cd $locbas cd 2005 !$erase cpsb2005.txt } /* Jan-Dec 2006 */ local i=`i'+1 } /* loop through months */ end