Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Creating filename variable
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Creating filename variable
Date
Tue, 25 Mar 2014 15:46:58 +0000
foreach <filename> in <filenames> {
<get>
<do>
gen file_name = "`filename'"
<put>
}
Nick
[email protected]
On 25 March 2014 15:43, Anya Burton <[email protected]> wrote:
> I'm creating a do file that loops through files in a directory formatting
> them. I need to extract the name of each file and save it as variable
> (file_name) within that file. Could anyone advise me on how to do this?
>
> Many thanks in advance!
>
> Anya
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/