Stata Technical Bulletin
STB-8
Fill in DOS-DEVICE with “c:\os2\mdos\ansi.sys”. Fill in EMS-MEMORY-LIMIT with the amount of expanded memory
to allocate to Stata, which might be as little as 1024 or as much as 6656 (the maximum regular Stata can use). 1024
corresponds to 1 megabyte and 6656 corresponds to just over 6 megabytes.
Finally, click on Save to save the settings and Close to close the windows.
3. To use regular Stata, double click on the Stata icon in the Additional dos programs folder. Once in Stata, however, you
must ‘set ANSI on’.
Intercooled Stata
1. Let’s pretend you have installed Intercooled Stata as istata.exe. You must create a BAT file containing the line “istata
/k2000”, where the 2000 means Stata is to allocate 2 megabytes to its data areas. You can make this number larger or
smaller. Assume the BAT file is called ist.bat.
2. Migrate ist.bat to the Additional DOS programs folder.
3. You will need to adjust DPMI_DOS_API and DPMI_MEMORY_LIMIT and install the DOS.DEVICE ansi.sys driver. Both are
defined on the dos settings menu.
To get to the menu, click on the Additional DOS programs folder and then click the right mouse button on the ist.bat
icon. Click on Open, Settings, Session, and dos settings.
Fill in DOS-DEVICE with “c:\os2\mdos\ansi.sys”. Set DPMI.DOS.API to enabled (not auto). Fill in DPMI.MEMORY.LIMIT
with 2 if you specified ∕k2000 in your ist.bat file; 3 if you specified ∕k3000; and so on. Intercooled Stata can
allocate considerable amounts of memory. To create a session with 64 megabytes, specify ∕k64000 in ist.bat and fill in
DPMI.MEMORY.LIMIT with 64. 64 megabytes is not the upper limit so far as Intercooled Stata is concerned.
Finally, click on Save to save the settings and Close to close the windows.
4. To use Intercooled Stata, you double click on the ist.bat icon in the Additional DOS programs folder. Once in Stata,
however, you must ‘set ANSI on’. If you wish to run Intercooled Stata in the background, you must first ‘set graphics
off’ before escaping from the window. Also note, if you go back and change ist.bat, you must re-migrate the BAT file
to the Additional dos programs folder.
os6 Importing and exporting text files with Stata
Phil Goldberg, Systems Manager, Cardiology, Children’s Memorial Hospital, Chicago, IL, FAX 312-880-3324
[Mr. Goldberg has supplied executable C programs for the Unix environment. He is working on a DOS version at present and will make them
available when completed. On the current STB diskette you will find the C source code and do-files.—Ed.]
Part I. Stata data exportation
Anyone who has tried to use Stata’s outf ile command has probably discovered that it formats output lines for an 80-column
page. According to Bill Gould at CRC, early DOS users requested this so that they could print outf ile generated files. Although
CRC plans an outf ile command option to permit lines to continue regardless of length and terminate only when the record
(“tuple”, “observation”) ends, no version exists now.
The problem lies in the fact that most other software expects one record per line. outfile’s writing of multiple lines
wreaks havoc on most efforts to cleanly export Stata datasets. After speaking with Mr. Gould, he suggested an approach which
I’ve implemented below.
Very simply, the approach is a two-part process. The first part is to write two files. In the first file, the number of variables
(columns) is written. In the second file, the data is exported using the outf ile command. The second part involves using the
information contained in the two files to create a comma-separated export file. All of these operations are transparent to the user,
making it usable by ordinary mortals.
The first part is implemented in a Stata do-file. The second part is a C program. Neither program can be considered a
paragon of style, but they should work as advertised.
Part II. Stata data importation
Another issue, and one which Stata is much better at handling, is the importation of data. Using the infile command,
the user can read a comma-separated file into a set of variables. If you have a lot of variables, this can be tedious because,
very often, the names of the variables happen to be located on the first line of the file. The infile command becomes very
unwieldy when you have to list each variable name with it. To solve this, a C program called sep2stata reads a “separated”
file and writes it out with a data dictionary at the top (and replaces missing information with “.”, along with other miscellany).