Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Struggles with macro quotes

From   "Barclay Matthew (PUBLIC HEALTH ENGLAND)" <>
To   "" <>
Subject   RE: st: Struggles with macro quotes
Date   Tue, 8 Oct 2013 12:52:21 +0100

This particular problem could also be caused by the leading space...

display subinstr("`c(current_date)'"," ","_",.)


-----Original Message-----
From: [] On Behalf Of Nick Cox
Sent: 08 October 2013 12:42
Subject: Re: st: Struggles with macro quotes

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


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


On 8 October 2013 12:21, Michael Costello <> 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:


This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
NHSmail provides an email address for your career in the NHS and can be accessed anywhere


*   For searches and help try:

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