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

st: Filenames of datasets

From   Henrik Stovring <>
To   statalist <>, Stata Technical Support <>
Subject   st: Filenames of datasets
Date   Wed, 26 Oct 2005 11:38:41 +0200

Dear Stata and Statalist,

Having recently worked on updating the -gzsave- package, I have become
aware of some of the internal details in the way Stata handles the
filename of a dataset. When a dataset is opened or saved, the global
macro S_FN is set to contain the name of the file containing the
dataset. A subsequent -describe- will then report this filename, while a
-save- command without an explicit filename will save the dataset in
memory to this filename.

What puzzles me is that this system takes no account of any intermediate
-cd- command. This means that if you open a dataset in your current
directory, say dir1, change to another directory, say dir2, and do a
-save, replace- then the dataset is saved in the dir2 directory with the
same filename as the dataset from dir1. I think this might create some
confusion, and to me the obvious remedy would be to let S_FN contain the
complete path with the filename of the dataset opened/saved. This would
also make the information presented with -describe- absolutely accurate,
so that there can be no doubt as to which filename the data originated
from. Alternatively (but to me less attractive), a flag could be set
indicating whether or not the working directory has been changed since
the dataset was last opened/saved, and perhaps even record the relative
changes in directory location in another macro, so that this could be
used by -save- and -describe- to point to the actual filename of the



Henrik St°vring, PhD

Research Unit of General Practice
University of Southern Denmark
J.B. Winsl°ws Vej 9
DK-5000 Odense C
Phone: (+45) 6550 3692
Fax: (+45) 6591 8296
*   For searches and help try:

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