Bookmark and Share

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: capturing directories and file names that start with numebrs, ex: "1111.zip" (problem with dir extended_macro_function)


From   Lucas Ferreira Mation <[email protected]>
To   [email protected]
Subject   Re: st: capturing directories and file names that start with numebrs, ex: "1111.zip" (problem with dir extended_macro_function)
Date   Tue, 29 Jan 2013 19:07:38 -0200

Dear Daniel,

thank you for answer and providing an example and sory for the slopy
question. My original problem (adapted to your example) was:

. cd c:/ado
. sysuse auto ,clear
. sa 42.dta
. sa 43.dta
. di "`list2'"
dta" "43:  operator invalid

This was a problem with the display, not the file list extraction
iself. I got stuck here because I was pretesting with display.
However, if instead of diplaying I use the list in a loop, it will
works perfectly:

. foreach i in   `list2' {
  2. di "`i'"
  3. }
42.dta
43.dta

. erase 42.dta
. erase 43.dta


again thank you very much for the help.







On Tue, Jan 29, 2013 at 6:09 PM, daniel klein <[email protected]> wrote:
> The example just sent does not actually work. This however has nothing
> to do with the file name beeing numeric ...
>
> Try instead
>
> cd c:/ado
> sysuse auto ,clear
> sa 42.dta
> di `"`: dir . file "*.dta'""'
> erase 42.dta
>
> Sorry for the inconvenience.
>
> Daniel
>
> --
> This works perfect for me
>
> cd c:/ado
> sysuse auto ,clear
> sa 42.dta
> di `": dir . file "*.dta""'
> erase 42.dta
> *
> *   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/


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