Search with Srcware can be started from the Srcshell run editor or from Srcware. Using the Search Srcware 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 Srcware run name and statements and Search run name and statements with your own.
<srcware name="search_example"> /* search example - srcware version */ /* import the input dataset */ <getdata name="search_data"> data search_data.txt; metadata; delim "\t"; skip 1; variables name=V16306 label="SIZE LGST CITY/COUNTY 89" type=num; name=V16631 label="AGE OF 1989 HEAD"; name=V16973 label="D1 CHKPT"; name=V17459 label="L7 GREW UP FARM OR? HD"; name=V17466 label="L13 PARENTS POOR OR? HD"; name=V17467 label="L14-15 EDUC OF FATHER H"; name=V17468 label="L16-17 EDUC OF MOTHER H"; name=V17483 label="L32 RACE OF HEAD 1"; name=V17536 label="HEAD 88 AVG HRLY EARNING"; name=V17538 label="REGION OF 1989 INTERVIEW"; name=V17543 label="HEAD GEOGRAPHIC MOBILITY"; name=V17545 label="EDUCATION 1989 HEAD"; name=V17612 label="1989 FAMILY WEIGHT"; end; run; </getdata> /* run search */ <search name="search"> datain search_data; title Hourly earnings analysis; depv=v17536 wt=v17612 null=.05 expl=0.4; v=(v16306,v16631,v17459,v17466,v17467,v17468,v17483,v17543,v17545); v=(v16973,v17538) s; run; </search> </srcware>
If the search_data.set and search.set files exist, perhaps from a previous run, you can reuse them by replacing <search name=”search”>…</search> and <getdata name=”search_data”>…</getdata> with the following.
<getdata name="search_data" /> <search name="search" />
- In Srcshell, click “run”. In emacs, press F8.
Once you’ve created an Srcware setup file, search_example.set in the example, you can reuse it by issuing the following command.
~/srclib/bin/srcware search_example.set
Starting from Srcware
- Download and install Srclib as described in the Search Installation Guide.
- In a text editor, create and save a Srcware setup file with the following structure, replacing the Srcware statements and the Search run name and statements with your own.
- Open a terminal or command window.
- Change to the working directory you want to use.
- Submit the following, changing the name and paths as needed.
/* search example - srcware version */ /* import the input dataset */ %getdata(name=search_data, setup=new); data search_data.txt; metadata; delim "\t"; variables name=V16306 label="SIZE LGST CITY/COUNTY 89" type=num; name=V16631 label="AGE OF 1989 HEAD"; name=V16973 label="D1 CHKPT"; name=V17459 label="L7 GREW UP FARM OR? HD"; name=V17466 label="L13 PARENTS POOR OR? HD"; name=V17467 label="L14-15 EDUC OF FATHER H"; name=V17468 label="L16-17 EDUC OF MOTHER H"; name=V17483 label="L32 RACE OF HEAD 1"; name=V17536 label="HEAD 88 AVG HRLY EARNING"; name=V17538 label="REGION OF 1989 INTERVIEW"; name=V17543 label="HEAD GEOGRAPHIC MOBILITY"; name=V17545 label="EDUCATION 1989 HEAD"; name=V17612 label="1989 FAMILY WEIGHT"; end; run; /* run search */ %search(name=search, setup=new); datain search_data; title Hourly earnings analysis; depv=v17536 wt=v17612 null=.05 expl=0.4; v=(v16306,v16631,v17459,v17466,v17467,v17468,v17483,v17543,v17545); v=(v16973,v17538) s; run;
~/srclib/bin/srcware search_example.set