Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Deciding whether to add a filename extension

From   Roger Newson <>
Subject   st: Deciding whether to add a filename extension
Date   Mon, 10 Oct 2005 19:09:21 +0100

Fellow statalisters (especially StataCorp):

I have a query about how, in general, Stata decides whether to add an extension to a filename provided by the user. For instance, in the built-in Stata command -outfile-, if the -using- filename has no extension, then the extension .raw is added, but this can be overridden (at least under Windows) by terminating the -using- filename with a period, which causes the -using- file created to have a name without an extension. The default of adding an extension is common (eg it is used by -use- and -save- which both add the extension .dta by default), but is not universal. For instance, if we use -file open- with a filename without an extension, then -file open- adds no extension.

What is the algorithm used by Stata to decide whether a filename already has an extension? And is it the same for all operating systems? I ask because my own program --listtex- can fail when given a filename without an extension, because it uses both -outfile- and -file-, and I would like to fix this bug in a way that doesn't create other bugs in operating environments other than Windows 2000 (under which I use Stata 9.1). (Thanks again to Herve Stolovy for informing me about this bug.)

Best wishes (and thanks in advance)


Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
Division of Asthma, Allergy and Lung Biology
King's College London

5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605

Opinions expressed are those of the author, not the institution.

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index