Search with SPSS can be started from the Srcshell run editor or from SPSS. Using the Search SPSS example, here’s how.
Starting from the Srcshell run editor
- Download and install Srclib as described in the Search Installation Guide.
- In Windows start the Srcshell run editor. In Linux or Mac OS X run emacs with “-l ~/srclib/srcshell.el” as a command-line or icon option.
- Open or create and save an XML file (.xml) with the following structure, replacing the SPSS run name and statements and Search run name and statements with your own.
<spss name="search_example"> /* search example - spss version */ /* import the input dataset */ get translate file="search_data.txt" /type=tab /fieldnames. variable labels V16306 "SIZE LGST CITY/COUNTY 89". variable labels V16631 "AGE OF 1989 HEAD". variable labels V16973 "D1 CHKPT". variable labels V17459 "L7 GREW UP FARM OR? HD". variable labels V17466 "L13 PARENTS POOR OR? HD". variable labels V17467 "L14-15 EDUC OF FATHER H". variable labels V17468 "L16-17 EDUC OF MOTHER H". variable labels V17483 "L32 RACE OF HEAD 1". variable labels V17536 "HEAD 88 AVG HRLY EARNING". variable labels V17538 "REGION OF 1989 INTERVIEW". variable labels V17543 "HEAD GEOGRAPHIC MOBILITY". variable labels V17545 "EDUCATION 1989 HEAD". variable labels V17612 "1989 FAMILY WEIGHT". save outfile="search_data.sav". /* run search */ <search name="search"> datain search_data; dataout search; title Hourly earnings analysis; depv=v17536 wt=v17612 null=.05 expl=0.4 estimate=r20 group=r30; v=(v16306,v16631,v17459,v17466,v17467,v17468,v17483,v17543,v17545); v=(v16973,v17538) s; run; </search> </spss>
If the search.set file exists, perhaps from a previous run, you can reuse it by replacing <search name=”search”>…</search> with the following.
<search name="search" />
- In Srcshell, click “run”. In emacs, press F8.
- When SPSS comes up, select “all” and click the “run” icon.
Once you’ve created an SPSS setup file, search_example.sps in the example, you can reuse it by issuing the following command.
spss search_example.sps
Starting from SPSS
- Download and install Srclib as described in the Search Installation Guide.
- Start SPSS.
- Change to the working directory you want to use.
- In the SPSS Syntax Editor, create and save a Search setup file (.set) with the following structure, replacing the Search statements with your own. The name of the opened or saved file should be the one you use in the invocation of Search below.
datain search_data; dataout search; title Hourly earnings analysis; depv=v17536 wt=v17612 null=.05 expl=0.4 estimate=r20 group=r30; v=(v16306,v16631,v17459,v17466,v17467,v17468,v17483,v17543,v17545); v=(v16973,v17538) s; run;
- In the Syntax Editor, open or create and save an SPSS setup with the following structure, replacing the srclib location, the SPSS statements and the Search run name with your own. Note that the srclib import path is the spss subdirectory of the srclib directory.
begin program. import sys sys.path.insert(0, '~/srclib/spss') import srclib end program. /* search example - spss version */ /* import the input dataset */ get translate file="search_data.txt" /type=tab /fieldnames. variable labels V16306 "SIZE LGST CITY/COUNTY 89". variable labels V16631 "AGE OF 1989 HEAD". variable labels V16973 "D1 CHKPT". variable labels V17459 "L7 GREW UP FARM OR? HD". variable labels V17466 "L13 PARENTS POOR OR? HD". variable labels V17467 "L14-15 EDUC OF FATHER H". variable labels V17468 "L16-17 EDUC OF MOTHER H". variable labels V17483 "L32 RACE OF HEAD 1". variable labels V17536 "HEAD 88 AVG HRLY EARNING". variable labels V17538 "REGION OF 1989 INTERVIEW". variable labels V17543 "HEAD GEOGRAPHIC MOBILITY". variable labels V17545 "EDUCATION 1989 HEAD". variable labels V17612 "1989 FAMILY WEIGHT". save outfile="search_data.sav". /* run search */ begin program. srclib.search(name="search") end program.
- Select “all” and click the “run” icon.