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: Struggles with macro quotes


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Struggles with macro quotes
Date   Tue, 8 Oct 2013 12:42:22 +0100

You don't spell out which file you are looking for here.

Your code segment implies that `c(current_date)' is being expanded as
8 Oct 2013, which is entirely in order.

Otherwise, I don't believe that you give us exactly what you typed as
it is hard to believe that

file

will be interpreted by Stata as

DFID MT Kiswahili

without some extra quotation marks.

If anything else is hinted by your post, it is that you may be being
bitten by the use of a backslash, which is repeatedly warned against
in Stata documentation. Regardless of operating system, Stata is happy
to work with forward slashes as filename separators. For one version
of the facts, see

http://www.stata-journal.com/sjpdf.html?articlenum=pr0042

Nick
njcoxstata@gmail.com


On 8 October 2013 12:21, Michael Costello <michaelavcostello@gmail.com> wrote:

> I continue my struggle with macro quotes. It seems that no matter how
> many permutations I try, I cannot get the (it seems to me) "magic
> formula" of the correct ` and " and ' to align correctly to do what
> I'd like. Perhaps I'm in search of an algorithm more than I am in
> search of an answer to my specific question. But as always, any help
> is much appreciated.
>
> My current problem is the piece of code below:
>
> insheet using "`c(current_date)'\file 2013.csv", clear
>
> which yields the following error (in Stata's harsh red, telling me I
> really should know better):
>
> file 8 Oct 2013\DFID MT Kiswahili 2013.csv not found
*
*   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