Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Does Stata store the name of dta files

From   Nick Cox <>
Subject   Re: st: Does Stata store the name of dta files
Date   Fri, 31 Dec 2010 12:15:02 +0000

To clarify your question you might need to specify what operating
system you are using. I guess Windows from the mention of
double-clicking and because it is usually Windows users who assume
that they don't need to specify such details!

I also guess wildly that you will not make much progress along your
preferred path. In essence you want to pass an argument to
via Stata's interaction with the operating system. I can't see a
method to do that. It's partly a question of what very low level
handles are available and partly of what Stata does first, execute or do what's implied by double-clicking.

Otherwise put, Stata can only store what it has imported somehow and
you can only access what Stata has stored from within something that
is executed within Stata.

Your main alternatives appear to include

1.  To check out what you can tune when invoking Stata in batch mode.
The details are operating system dependent. -search batch- is one

2. To -describe- datasets -using- to see how big they are before
-set-ting memory appropriately. There's perhaps more scope for
automation that way. But it wouldn't be via but via writing
your own start-up routine that specifies a dataset and checks if you
need to change memory requirements.

If you are using Windows, being able to get into Stata by
double-clicking on files to open them is at best a kind of token nod
to that way of working within Windows. It's important to realise that
Stata is written in ways that try to maximise platform-independence;
it is not written as a Windows application that happens to be portable
to other platforms (in fact it is more nearly written as a Unix
application and vice versa). Stata respects your approach, but mostly
through the expectation that you open Stata first and then tune as you
see fit.

Nick Cox

Joshua Ruben

> A common problem I run into with Stata is trying to open dta files that are too big (error r(901)). It's more of an annoyance than a problem. Increasing the memory and loading the data set again solves the problem. I suppose I could also permanently increase the default memory for Stata. But what I'd like to do is add code to my profile that automatically adjusts the memory in Stata when I try to open a dta file so that it fits.
> My problem is that I don't know where Stata stores the name of the dta file I'm trying to open. When the file is actually loaded, the file name is automatically saved in the global S_FN. Before that--between double-clicking on the dta file and the file being loaded--Stata opens and runs Is there a way to reference the name of the dta file on which I double-clicked from
> Please let me know if my question is at all unclear.

*   For searches and help try:

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