[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
kturner@stata.com (Kevin Turner) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Re: limitation of -filefilter- |

Date |
Tue, 23 Nov 2004 08:53:31 -0600 |

Phil Schumm <pschumm@uchicago.edu> writes: ... >-filefilter- does appear however to have some limitations regarding >how the file(s) are specified. First, it doesn't appear that you can >use paths in the file specifications. For example: > >. filefilter /Users/pschumm/foo.txt /Users/pschumm/foobar.txt, f("a") t("b") >varlist not allowed >r(101); This is a bug; it is incorrectly parsing on non-space characters. If you use double quotes to enclose the paths it will work, but the original problem will be fixed in the next executable update. If any path contains spaces, it will always need to be double quoted, for -filefilter- or any other Stata command. >Second, if I've got a "$" embedded in a file name, I can't seem to >specify the file. For example: > >. filefilter foo\$bar.txt foo\$bar2.txt, f("a") t("b") >varlist not allowed >r(101); > >where the "\" is (presumably) needed to escape the "$", thus >preventing macro expansion. Yes, the slash does prevent macro expansion. The reason that a single backslash doesn't work here lies in the fact that there is already a backslash preceding the file name. When the first pair of backslashes is encountered, they collapse down to a single backslash (there is a backslash escaping a backslash). The next character to be parsed is the dollar sign, which now has no preceding backslash since the previous two were already parsed. The necessary solution requires three backslashes for the Stata parser to correctly interpret the path. Thus, a correct path would look like: . filefilter "foo\\\$bar.txt" "foo\\\$bar2.txt", f("a") t("b") This issue involving escape characters and macro expansion is, unfortunately, one that you could encounter with any Stata command, not just -filefilter-. Hope this helps. --Kevin kturner@stata.com * * 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/

**Follow-Ups**:**Re: st: Re: limitation of -filefilter-***From:*Phil Schumm <pschumm@uchicago.edu>

- Prev by Date:
**st: RE: Re: chi squared matrix** - Next by Date:
**st: Direct downloads [Was Re: panel unit root tests]** - Previous by thread:
**st: RE: splitting variables** - Next by thread:
**Re: st: Re: limitation of -filefilter-** - Index(es):

© Copyright 1996–2022 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |