If you collaborate with people who use other statistical software with proprietary data file formats, you will find Stat/Transfer useful for converting between Stata and said software. How to do that using the Stat/Transfer GUI is easy enough to figure out. But you can also run Stat/Transfer from within Stata. If you are on a Windows machine, here's one example:


local from  "D:\original files"
local to    "D:\sas files"

// add file names here as needed
local txt_files "BPALL"
local xls_files "BO"

// transfer to SAS format. see Stat/Transfer command file help
// sasx is for SAS Transport files. Change as needed on line 35 below. Options are:
/*
SAS V6 for Windows and OS/2          -- sas2
SAS V7, V8 and V9 for Windows        -- sas
SAS V6 for Mac, Unix - HP, Sun, IBM  -- sas1
SAS V6 for Unix - DEC                -- sas4
SAS Transport Files                  -- sasx
*/
// other options:
// /Y means "yes, overwrite as needed"
// /V means "verbose output"
tempname fh_out
local foo set path="C:\Program Files\StatTransfer7\";%path%
local myfileout "`from'\convert.bat"
file open `fh_out' using "`myfileout'", replace write
file write `fh_out' `"`foo'"' _n
foreach filetype in txt xls {
  foreach filename in ``filetype'_files' {
    local input_file   `from'\`filename'.`filetype'
    local output_sas   `to'\`filename'.dat
    capture confirm file "`output_sas'"
    if _rc!=0 {
      local bar st "`input_file'" sasx "`output_sas'" /Y /V
      file write `fh_out' `"`bar'"' _n
    }
  }
}
file close `fh_out'
winexec "`myfileout'"

There you have it. This works with Stata 9.2 and Stat/Transfer 7. I don't have either. I wrote this for a client and tested in on their machine.

Update: still unclear why indentation isn't working like it used to, but there's a workaround: using the <pre></pre> HTML tags. Having a graphical interface like WordPress for blogging should in theory make it unnecessary to revert to HTML, but it's only one pair of tags and I like the result. I'll live with it. As to a non-Windows version of the code above, check Eric's comment below.