Import and export Lotus 123 files (DOS only) [STB-13: os8] -------------------------------------------- ^limport^ filename [^, clear replace^] ^lexport^ filename [^, replace^] ^limport^ converts the Lotus(tm) 123 file filename^.wk1^ to a Stata-format file filename^.dta^ and loads the file into Stata. By default, Stat/Transfer is used to perform the conversion (available from C.R.C.; see [0] transfer), but ^limport^ can be configured to use other software (see Technical Details, below). ^lexport^ converts the Stata data in memory into a Lotus 123 file filename^.wk1^. As with ^limport^, Stat/Transfer is used by default but ^lexport^ can be configured to use other software. Options ------- ^clear^ means the same thing as ^replace^. ^replace^, used with ^limport^, means filename^.dta^ may be replaced if it already exists. Used with ^lexport^, it means filename^.wk1^ may be replaced if it it already exists. ^limport^: Examples ----------------- You are using Stata and want to load the data saved in a Lotus 123 spreadsheet. In Lotus, you previously saved the data as ^myfile.wk1^: . ^limport myfile^ This command not only loads the data, it creates ^myfile.dta^ so that, in the future, you can simply type "^use myfile^". ^limport^: Examples, continued ----------------------------- You later update your spreadsheet and, in Lotus, save it again. In Stata, you attempt to re-import the data: . ^limport myfile^ file myfile.dta already exists r(602); To re-import the data, ^limport^ must recreate the Stata version of the data and that version already exists. To have ^limport^ replace the existing the file anyway, type: . ^limport myfile, replace^ This is equivalent to typing: . ^erase myfile.dta^ . ^limport myfile^ ^limport^: Examples, concluded ----------------------------- The Lotus data you wish to import is saved in a different directory, say C:\LOTUS. To import the data, you type: . ^limport c:\lotus\myfile^ The newly created ^myfile.dta^ will also be saved in that directory, so in the future, to reload the data, you must type: . ^use c:\lotus\myfile^ If you do not want to keep the Stata-format data there, you might type: . ^erase c:\lotus\myfile.dta^ . ^save myfile^ ^lexport^: Examples ------------------ You are using Stata and wish to save the data in memory for subsequent use in Lotus. If you type . ^lexport myfile^ ^myfile.wk1^ will be created in the current directory. If you have done this before with the same filename, you rather than ^myfile.wk1^ being created, you will see: . ^lexport myfile^ file myfile.wk1 already exists r(602); If you are willing to replace that file, you can type: . ^lexport myfile, replace^ If you want to save ^myfile.wk1^ in C:\LOTUS, you can type: . ^lexport c:\lotus\myfile^ Assumptions ----------- ^limport^ and ^lexport^ assume: 1) you own Stat/Transfer 2) Stat/Transfer has been installed in C:\ST. If this is not true, see the Technical Details, below. Also see -------- STB: os8 (STB-13) Manual: [0] transfer On-line: ^help^ for ^lotus^. Technical details ----------------- These details will be of interest only if (1) You own Stat/Transfer but have not installed it in C:\ST. (2) You do not own Stat/Transfer but have some other utility which can translate data sets. By default, ^limport^ and ^lexport^ assume Stat/Transfer has been installed in C:\ST. To change fn.wk1 into fn.dta, limport issues the command ^c:\st\transfer fn.wk1 fn.dta > nul^ to DOS. To change fn.dta into fn.wk1, ^lexport^ issues the command: ^c:\st\transfer fn.dta fn.wk1 > nul^ Technical details, continued ---------------------------- Four global macros control the command actually issued: $S_IMPO, $S_IMPO2, $S_EXPO, and $S_EXPO2. The actual commands issued by ^limport^ and ^lexport^ are: ^$S_IMPO fn.wk1 fn.dta $S_IMPO2^ ^$S_EXPO fn.dta fn.wk1 $S_EXPO2^ If the four macros are not defined, ^limport^ (^lexport^) pretends $S_IMPO and $S_EXPO contain "c:\st\transfer" and that $S_IMPO2 and $S_EXPO2 contain "> nul". Thus, ^limport^'s ^$S_IMPO fn.wk1 fn.dta $S_IMPO2^ is the same as ^c:\st\transfer fn.sk1 fn.dta > nul^ and similarly for ^lexport^. Technical details, continued ---------------------------- Assume Stat/Transfer is installed not in C:\ST but in D:\ST. Typing: . ^mac def S_EXPO "d:\st\transfer"^ . ^mac def S_IMPO "d:\st\transfer"^ will make ^limport^ and ^lexport^ work anyway. When ^limport^, for instance, trans- lates a data set, it will issue the command: ^$S_IMPO fn.wk1 fn.dta $S_IMPO2^ Since $S_IMPO has been redefined, this command will be ^d:\st\transfer fn.wk1 fn.dta > nul^ (If you have Stat/Transfer installed someplace other than C:\ST, you will want to automate the definition of these macros. See the last technical note in [1] start/stop for a way to do this.) Technical details, continued ---------------------------- Assume that you do not own Stat/Transfer but that you own some other file translation utility which has the capability to convert Lotus to Stata data sets and vice-versa. To make the problem difficult, we will assume that this other translation utility has the command syntax: ^xlate lotus=^fn.wk1 ^to stata=^fn.dta To fix ^limport^, you first write a .BAT file which we will call ^l_to_s.bat^: ^@ECHO OFF^ ^xlate lotus=%1 to stata=%2^ In Stata, you reset $S_IMPO: . ^mac def S_IMPO "l_to_s"^ Now, typing ^limport^ will invoke ^l_to_s^ which, in turn, will invoke ^xlate^.