Phil Schumm <[email protected]> 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
[email protected]
*
* 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/