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: Get actual file name

From   Maarten Buis <>
Subject   Re: st: Get actual file name
Date   Tue, 5 Jul 2011 10:23:11 +0200

On Tue, Jul 5, 2011 at 10:09 AM, Renger van Nieuwkoop wrote:
> Is it possible to get the actual file name in Stata. I want to use this information to automatically name my log file? (so I can use this for every other file over and over again)
> E.g. something like:
> - Get actual file name   (for example :, save it in a local macro "actual"
> - log using "actual"

Which file is the "actual" file? The data file, the do-file, the
master do-file that calls the do-file, the intermediate do-file that
is called by the master do-file and calls another do-file, etc.?

I would just define a global macro in the master do-file that defines
"the name" for your project (call it something like proj_name) and
derive the names for log file from that global (e.g.
${proj_name}_dataprep, ${proj_name}_descrip, ${proj_name}_analysis,

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen

*   For searches and help try:

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