Sunday, August 12, 2007

Use Stat/Transfer inside of Stata

As a stata user, you may find out there are limited types of data stata can read in directly. Normally, we use Stat/Transfer to transfer data into stata format. Roger Newson wrote a stata package --stcmd-- that can call Stat/Transfer inside of stata.

To install the package, simply type:

ssc install stcmd

To use stcmd, you need to set up the program path for Stat/Transfer:

global StatTransfer_path `"c:\Program Files\StatTransfer9\st.exe"'

Here is the sample code to read in an Excel data with extension xls:

inputst test.xls

To export data from stata to R inside of stata:

outputst test.Rdata

No comments: