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

[no subject]



I believe you need to evaluate the c(filename) term.  For example:


. sysuse auto,clear
(1978 Automobile Data)

. globa orig = c(filename)

. di "$orig"
C:\Program Files\Stata9\ado\base/a/auto.dta

. clear

. use "$orig"
(1978 Automobile Data)

.

Hope this helps,
Scott


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Laura Gibbons
> Sent: Thursday, December 22, 2005 6:24 PM
> To: [email protected]
> Subject: st: c(filename), quotes
>
> I'm running Intercooled Stata 8.2 on Windows.
>
> I have 2 related questions about how to create a macro that contains the
> name of the open file, and then how to set up the quotes to access that
> file later.  Here is a simplified example:
>
> . use actthetawide.dta, clear
> . global origdata c(filename)
> . di $origdata
> actthetawide.dta
>
> . clear
> . use $origdata
> invalid '('
> r(198);
>
> Does anyone know why the error message?
>
> Secondly, in real life there will usually be a path name that contains
> spaces, so my program will have to put quotes around the file name.  I'd
> like it to interpret
>
> .use (some quotes)$origdata(other quotes)
>
> to mean
>
> use "actthetawide.dta"
>
> but no matter what combination of quotes I try, I can't get the filename
> to display inside the quotes.  I get back "c(filename)"  or "$origdata" 
or
> some such nonsense, depending on what I do.
>
> I searched the manual and the archives to no avail, so I'm hoping you 
can
> help!
>
> Many thanks, Laura
>


*
*   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/

     * References:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laura E. Gibbons, PhD
General Internal Medicine, University of Washington
Box 359780
Harborview Medical Center
325 Ninth Avenue, Seattle, WA  98104

phone: 206-744-1842   fax: 206-744-9917
Office address: 401 Broadway, Suite 5122
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*   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