* ------------------------------------------------------------ *.
*  This command file was generated by SOEPINFO-WWW             *.
*  from the SOEP HOMEPAGE: http://www.diw-berlin.de/soep.      *.
*                                                              *.
*      !!! I M P O R T A N T  -  W A R N I N G !!!             *.
*  You alone are responsible for contents and appropriate      *.
*  usage by accepting the usage agreement.                     *.
* ------------------------------------------------------------ *.
*  To copy this command file to your own harddisk:             *.
*  Use your mouse or (CNTL-A) to select this text, then "copy" *.
*  (CNTL-C) then in your windows application, or in a text     *.
*  editor, "paste" (CNTL-V).                                   *.
* ------------------------------------------------------------ *.
*                                                              *.
*  Please report any errors of the SPSS code generated here    *.
*  to John Haisken-DeNew: jhaiskendenew@diw.de                 *.
* ------------------------------------------------------------ *.
*  WARNING: SPSS for UNIX only allows up to 99 files to        *.
*           be accessed in a single retrieval. This is hard    *.
*           coded by SPSS and we cannot change this. You may   *.
*           have to run your retrieval in smaller blocks.      *.
*  ----------------------------------------------------------- *.
*                                                              *.
set compression on.
set header off.

*  ----------------------------------------------------------- *.
*                                                              *.

* Anpassung an relative Pfade von Dr. Kajetan Hinner, 3/7/2003 *.
*         *.
* Sie müssen hier nur die Pfade Ihres Systems eintragen  *.
 

define !pathin() "o:\soep\lehre\" !enddefine.
define !pathout() "u:\temp\" !enddefine.
 

* ----------------[ automatically pull PPFAD ]----------------- *.

get  file = !pathin + 'ppfad.sav'
    /keep = hhnr    persnr  sex     gebjahr psample
            ahhnr   bhhnr   chhnr   dhhnr   ehhnr   fhhnr   ghhnr   hhhnr
            ihhnr   jhhnr   khhnr   lhhnr   mhhnr   nhhnr   ohhnr   phhnr
            qhhnr   rhhnr
            anetto  bnetto  cnetto  dnetto  enetto  fnetto  gnetto  hnetto
            inetto  jnetto  knetto  lnetto  mnetto  nnetto  onetto  pnetto
            qnetto  rnetto.

* --------------[ balanced / unbalanced design ]--------------- *.

select if ( (anetto eq 1) or (bnetto eq 1) or (cnetto eq 1) or
            (dnetto eq 1) or (enetto eq 1) or (fnetto eq 1) or
            (gnetto eq 1) or (hnetto eq 1) or (inetto eq 1) or
            (jnetto eq 1) or (knetto eq 1) or (lnetto eq 1) or
            (mnetto eq 1) or (nnetto eq 1) or (onetto eq 1) or
            (pnetto eq 1) or (qnetto eq 1) or (rnetto eq 1) ).

* ----------------------[ define sample ]---------------------- *.

select if ( (psample eq 1) or (psample eq 2) or (psample eq 3) or
            (psample eq 4) or (psample eq 5) or (psample eq 6) ).

sort cases by hhnr persnr.
save outfile = !pathout + 'ppfad.sav'.

* -----------------[ automatically pull phrf ]----------------- *.

get  file = !pathin + 'phrf.sav'
    /keep = hhnr    persnr  prgroup
            aphrf   bphrf   cphrf   dphrf   ephrf   fphrf   gphrf   hphrf
            iphrf   jphrf   kphrf   lphrf   mphrf   nphrf   ophrf   pphrf
            qphrf   rphrf
            bpbleib cpbleib dpbleib epbleib fpbleib gpbleib hpbleib ipbleib
            jpbleib kpbleib lpbleib mpbleib npbleib opbleib ppbleib qpbleib
            rpbleib.

sort cases by hhnr persnr.
save outfile = !pathout + 'phrf.sav'.

* --------------[ automatically create pmaster ]--------------- *.

match files file  = !pathout + 'ppfad.sav'
           /table = !pathout + 'phrf.sav'
           /by      hhnr persnr.
 
sort cases by hhnr persnr.
save output = !pathout + 'pmaster.sav'.

* -------------------------( pull AP )------------------------- *.

get  file = !pathin + 'ap.sav'
    /keep = hhnr    ahhnr   persnr
            ap0301.

sort cases by hhnr persnr.
save outfile = !pathout + 'ap.sav'.

* -------------------------( pull BP )------------------------- *.

get  file = !pathin + 'bp.sav'
    /keep = hhnr    bhhnr   persnr
            bp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'bp.sav'.

* -------------------------( pull CP )------------------------- *.

get  file = !pathin + 'cp.sav'
    /keep = hhnr    chhnr   persnr
            cp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'cp.sav'.

* -------------------------( pull DP )------------------------- *.

get  file = !pathin + 'dp.sav'
    /keep = hhnr    dhhnr   persnr
            dp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'dp.sav'.

* -------------------------( pull EP )------------------------- *.

get  file = !pathin + 'ep.sav'
    /keep = hhnr    ehhnr   persnr
            ep0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'ep.sav'.

* -------------------------( pull FP )------------------------- *.

get  file = !pathin + 'fp.sav'
    /keep = hhnr    fhhnr   persnr
            fp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'fp.sav'.

* -------------------------( pull GP )------------------------- *.

get  file = !pathin + 'gp.sav'
    /keep = hhnr    ghhnr   persnr
            gp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'gp.sav'.

* -----------------------( pull GPOST )------------------------ *.

get  file = !pathin + 'gpost.sav'
    /keep = hhnr    ghhnr   persnr
            zp5501.

sort cases by hhnr persnr.
save outfile = !pathout + 'gpost.sav'.

* -------------------------( pull HP )------------------------- *.

get  file = !pathin + 'hp.sav'
    /keep = hhnr    hhhnr   persnr
            hp1001.

sort cases by hhnr persnr.
save outfile = !pathout + 'hp.sav'.

* -------------------------( pull IP )------------------------- *.

get  file = !pathin + 'ip.sav'
    /keep = hhnr    ihhnr   persnr
            ip9801.

sort cases by hhnr persnr.
save outfile = !pathout + 'ip.sav'.

* -------------------------( pull JP )------------------------- *.

get  file = !pathin + 'jp.sav'
    /keep = hhnr    jhhnr   persnr
            jp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'jp.sav'.

* -------------------------( pull KP )------------------------- *.

get  file = !pathin + 'kp.sav'
    /keep = hhnr    khhnr   persnr
            kp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'kp.sav'.

* -------------------------( pull LP )------------------------- *.

get  file = !pathin + 'lp.sav'
    /keep = hhnr    lhhnr   persnr
            lp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'lp.sav'.

* -------------------------( pull MP )------------------------- *.

get  file = !pathin + 'mp.sav'
    /keep = hhnr    mhhnr   persnr
            mp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'mp.sav'.

* -------------------------( pull NP )------------------------- *.

get  file = !pathin + 'np.sav'
    /keep = hhnr    nhhnr   persnr
            np0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'np.sav'.

* -------------------------( pull OP )------------------------- *.

get  file = !pathin + 'op.sav'
    /keep = hhnr    ohhnr   persnr
            op0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'op.sav'.

* -------------------------( pull PP )------------------------- *.

get  file = !pathin + 'pp.sav'
    /keep = hhnr    phhnr   persnr
            pp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'pp.sav'.

* -------------------------( pull QP )------------------------- *.

get  file = !pathin + 'qp.sav'
    /keep = hhnr    qhhnr   persnr
            qp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'qp.sav'.

* -------------------------( pull RP )------------------------- *.

get  file = !pathin + 'rp.sav'
    /keep = hhnr    rhhnr   persnr
            rp0101.

sort cases by hhnr persnr.
save outfile = !pathout + 'rp.sav'.

* -----------( merge together by person: ALL Waves )----------- *.

match files file  = !pathout + 'pmaster.sav'
           /table = !pathout + 'ap.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'bp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'cp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'dp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'ep.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'fp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'gp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'gpost.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'hp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'ip.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'jp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'kp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'lp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'mp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'np.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'op.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'pp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'qp.sav'
           /by      hhnr persnr.

match files file  = *
           /table = !pathout + 'rp.sav'
           /by      hhnr persnr.

* --------------------( save output file )--------------------- *.

file label    "SOEPINFO: Magic at Work! http://www.diw.de/soep/".
save   outfile = !pathout + 'new.sav'.
desc   all.

* -----------------( discard temporary files )----------------- *.

erase file = !pathout + 'ppfad.sav'.
erase file = !pathout + 'phrf.sav'.
erase file = !pathout + 'pmaster.sav'.
erase file = !pathout + 'ap.sav'.
erase file = !pathout + 'bp.sav'.
erase file = !pathout + 'cp.sav'.
erase file = !pathout + 'dp.sav'.
erase file = !pathout + 'ep.sav'.
erase file = !pathout + 'fp.sav'.
erase file = !pathout + 'gp.sav'.
erase file = !pathout + 'gpost.sav'.
erase file = !pathout + 'hp.sav'.
erase file = !pathout + 'ip.sav'.
erase file = !pathout + 'jp.sav'.
erase file = !pathout + 'kp.sav'.
erase file = !pathout + 'lp.sav'.
erase file = !pathout + 'mp.sav'.
erase file = !pathout + 'np.sav'.
erase file = !pathout + 'op.sav'.
erase file = !pathout + 'pp.sav'.
erase file = !pathout + 'qp.sav'.
erase file = !pathout + 'rp.sav'.

finish.