12.07.2015 Views

SPSS Programming and Data Management, 4th Edition: A Guide for ...

SPSS Programming and Data Management, 4th Edition: A Guide for ...

SPSS Programming and Data Management, 4th Edition: A Guide for ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

11Best Practices <strong>and</strong> Efficiency TipsCOMPUTE var1=var1+ 5.RECODE var2 (1 thru 5=1) (6 thru 10=2).FREQUENCIES/VARIABLES=var1 var2/STATISTICS=MEAN STDDEV MIN MAX.DESCRIPTIVES/VARIABLES=var1 var2/STATISTICS=MEAN STDDEV MIN MAX.• The trans<strong>for</strong>med values from the two trans<strong>for</strong>mation comm<strong>and</strong>s that follow theTEMPORARY comm<strong>and</strong>willbeusedintheFREQUENCIES procedure.• The original data values will be used in the subsequent DESCRIPTIVES procedure,yielding different results <strong>for</strong> the same summary statistics.Under some circumstances, using TEMPORARY will improve the efficiency of ajob when short-lived trans<strong>for</strong>mations are appropriate. Ordinarily, the results oftrans<strong>for</strong>mations are written to the virtual active file <strong>for</strong> later use <strong>and</strong> eventually aremerged into the saved <strong>SPSS</strong> data file. However, temporary trans<strong>for</strong>mations will notbe written to disk, assuming that the comm<strong>and</strong> that concludes the temporary state isnot otherwise doing this, saving both time <strong>and</strong> disk space. (TEMPORARY followed bySAVE, <strong>for</strong> example, would write the trans<strong>for</strong>mations.)Ifmanytemporaryvariablesarecreated,notwritingthemtodiskcouldbeanoticeable saving with a large data file. However, some comm<strong>and</strong>s require two or morepasses of the data. In this situation, the temporary trans<strong>for</strong>mations are recalculated <strong>for</strong>the second or later passes. If the trans<strong>for</strong>mations are lengthy <strong>and</strong> complex, the timerequired <strong>for</strong> repeated calculation might be greater than the time saved by not writingthe results to disk. Experimentation may be required to determine which approach ismore efficient.Using Temporary VariablesFor trans<strong>for</strong>mations that require intermediate variables, use scratch (temporary)variables <strong>for</strong> the intermediate values. Any variable name that begins with a poundsign (#) is treated as a scratch variable that is discarded at the end of the series oftrans<strong>for</strong>mation comm<strong>and</strong>s when <strong>SPSS</strong> encounters an EXECUTE comm<strong>and</strong> or othercomm<strong>and</strong> that reads the data (such as a statistical procedure).Example*scratchvar.sps.DATA LIST FREE / var1.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!