07.02.2014 Views

Introduction to Stata 8 - (GRIPS

Introduction to Stata 8 - (GRIPS

Introduction to Stata 8 - (GRIPS

SHOW MORE
SHOW LESS

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

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

15.8. Exchange of data with other programs<br />

Beware: Translation between programs may go wrong, and you should check carefully eg. by<br />

comparing the output from SPSS' DESCRIPTIVES and <strong>Stata</strong>'s summarize. Especially<br />

compare the number of valid values for each variable and take care with missing values and<br />

date variables.<br />

StatTransfer [U] 24.4<br />

StatTransfer is a reasonably priced program (purchase: see Appendix 1) that translates<br />

between a number of statistical packages, including <strong>Stata</strong>. Variable names, and variable and<br />

value labels are transferred <strong>to</strong>o. StatTransfer 7 understands <strong>Stata</strong> 8 files, but StatTransfer 6<br />

does not. To create a <strong>Stata</strong> 7 data set for conversion by StatTransfer 6:<br />

saveold c:\dokumenter\proj1\alfa.dta<br />

Transferring data <strong>to</strong> Excel and other spreadsheets<br />

[R] outsheet<br />

Many statistical packages read Excel data. To create a tab-separated file (see section 8)<br />

readable by Excel:<br />

outsheet [varlist] using c:\dokumenter\proj1\alfa.txt , nolabel<br />

In Excel open the file as a text file and follow the instructions. Variable names, but no labels<br />

are transferred.<br />

[R] outfile<br />

If you want the data written <strong>to</strong> a comma-separated ASCII file the command is:<br />

outfile [varlist] using c:\...\alfa.txt , nolabel comma<br />

Reading Excel data<br />

[R] insheet<br />

Many packages can create Excel data, and probably all can create text files similar <strong>to</strong> those<br />

created by <strong>Stata</strong>'s outsheet command. From Excel save the file as a tab-separated text file<br />

(see section 8). <strong>Stata</strong> reads it by:<br />

insheet using c:\dokumenter\p1\a.txt , tab<br />

15.9. For old SPSS users<br />

SPSS and <strong>Stata</strong> have similarities and differences. Among the differences are:<br />

• While SPSS can define any numeric code as a missing value, <strong>Stata</strong>'s user-defined<br />

missing values are special codes; see section 6.3.<br />

• <strong>Stata</strong>'s missing values are high-end numbers. This may complicate conditions; see<br />

section 6.3.<br />

• While SPSS executes all transformation commands up <strong>to</strong> a procedure command one<br />

case at a time, <strong>Stata</strong> performs each command for the entire data set before proceeding <strong>to</strong><br />

the next command. This leads <strong>to</strong> different behaviour when combining selections (keep<br />

if; drop if) with observation numbers ([_n]).<br />

63

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

Saved successfully!

Ooh no, something went wrong!