Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: StatTransfer Questions

From   Eric Booth <>
To   "<>" <>
Subject   Re: st: StatTransfer Questions
Date   Sun, 6 Feb 2011 20:34:23 +0000


There are at least 2 options for running a batch of ST conversions (1) from Stata via -stcmd- (from SSC)  or (2) via the Terminal command line (which can be accessed from a do-file via the -shell- command).    I use (1). 

(1) From Stata I can invoke Stat Transfer on a set of files with something like this:

first, be sure you have the global  StatTransfer_path specified as described in the -stcmd- help file -- for my Mac OSX machine its:  

global StatTransfer_path "/applications/stattransfer9/st.command" 

then I can do the following to convert all files in a directory (BTW, I noticed you have this in your Dropbox, so I tried a couple of files in my DB to make sure the error didn't have to do with you using your DB folder).
So, grabbing some files from my public DB folder, you should be able to run the following to convert a set of .xlsx files to .dta from a do-file:

**install stcmd**
cap which stcmd
if _rc ssc install stcmd, replace

**batch convert**
forval n = 1/5 {	
  **~//  is my public DB**
	cap rm "/users/`c(username)'/dropbox/test`n'.dta"
copy "`n'.xlsx"  ///
	"/users/`c(username)'/dropbox/test`n'.xlsx", replace pub
stcmd "/users/`c(username)'/dropbox/test`n'.xlsx" ///
	"/users/`c(username)'/dropbox/test`n'.dta" /y /ocd 
	!open "/users/`c(username)'/dropbox//"
**watch for wrapping above**

(2) From Terminal, I can access Stat Transfer with:

Eric-LT:~ $  /applications/stattransfer9/st.command 

check to see if you can get to the prompt for ST with the command above.  If so, then you probably need to specify the path with the st command in Terminal (or put it your path), something like:

Eric-LT:~ $  /applications/stattransfer9/st.command     "/Users/caleb/Dropbox/union_pop/st/bls.stcmd"

I'm using Stat Transfer 9, Stata 11 MP, Mac OSX 10.6.6, so if the above don't work, maybe something has changed in ST 10 (?)

- Eric

Eric A. Booth
Public Policy Research Institute
Texas A&M University
Office: +979.845.6754

On Feb 6, 2011, at 1:46 PM, Caleb Southworth wrote:

> I am new to StatTransfer 10; used prior versions under Win98 without difficulty. Running Mac OSX.10.6.N.
> (1) running a command files from the Run Program window, this line still prompts for permission to overwrite. I would like to run a batch file of regular conversions and have ST overwrite without asking. 
> copy /Users/caleb/Dropbox/union_pop/odf/long_bls_giff/bls_1946.xls /Users/caleb/Dropbox/union_pop/orig/bls_1946.dta /y ocd 
> (2) How do I submit a batch file to run in ST from the command prompt? 
> That is, I open the terminal shell and type
> st filename.cmd
> or similarly 
> d109-244:StatTransfer10 caleb$ st /Users/caleb/Dropbox/union_pop/st/bls.stcmd
> -bash: st: command not found
> That is, I don't seem to be able to invoke st either from its directory or elsewhere. 
> Thanks!
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index