Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Should tempfile names always be quoted nowadays?


From   "Newson, Roger B" <[email protected]>
To   <[email protected]>
Subject   st: Should tempfile names always be quoted nowadays?
Date   Tue, 20 Feb 2007 23:10:30 -0000

Hello All

I use Stata 9.2 under Windows XP, and have a query on tempfile names. In
my system, the query

whelp tempfile

points to the on-line help for -macro-, and the other definitive
documentation for tempfiles seems to be in -[P] macro- on Pages 192-193.

I have traditionally used unquoted tempfile names in -use-, -save- or
-append- statements, both in my production do-files and in my
distributed ado-files, assuming that tempfile names do not contain
embedded blanks. These practices have not caused any problems in the
past. However, I  was advised today by a user of my -parmest- package
(downloadable from SSC) that -parmby- had suddenly started failing for
users on his local Windows XP system, and that he had managed to fix
this problem by creating a local version of -parmby-, in which the
tempfile names in -use-, -save- and -append- statements were always
surrounded by compound double quotes. This was apparently required
because, under his local system, Stata stores its tempfiles in a
subfolder of the system folder

C:\Documents and Settings\

whose name contains embedded blanks. This is also the case under my
Windows XP, but this has not so far been a problem, because, under my
Windows XP, Stata always knows tempfiles internally by abbreviated
names. As in:

**** BEGINNING OF Stata LOG - CUT HERE
. tempfile tf1

. disp as text "Temporary filename: " as result `"`tf1'"'
Temporary filename: C:\DOCUME~1\rnewson\LOCALS~1\Temp\ST_04000010.tmp
**** END OF Stata LOG - CUT HERE

However, I note that, on Page 193 of -[P] macro-, the tempfiles in the
demonstrated example are enclosed in single quotes. The tempfile names
in the Technical Note on that page contain no embedded spaces. However,
this seems to be changing, at least under some operating environments
some of the time. Does Stata have a policy on handling tempfile names
with embedded spaces (and other unusual characters)? And, in future,
when writing cross-platform ado-files, would users be recommended to use
simple compound quotes, or to use compound double quotes, or to use
something else again, to protect against even more unusual characters in
tempfile names?

Best wishes (and thanks in advance)

Roger


Roger Newson
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected] 
www.imperial.ac.uk/nhli/r.newson/

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

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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