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

st: RE: argument string with embedded comma

From   "Nick Cox" <>
To   <>
Subject   st: RE: argument string with embedded comma
Date   Wed, 10 Dec 2008 19:34:29 -0000

My experiments indicate that despite the " " or even `" "' Stata sees
the comma as indicating an option, which is not what you want. 

My only suggestion is that you define a string scalar, pass the name to
the do file and then print the string scalar contents. (A local won't
work.) Equivalently, a global would work too. 

scalar a = "whatever, wherever, whenever" 

do temp a 

The do file then starts 

args a 
di scalar(`a') 


-----Original Message-----
[] On Behalf Of Feiveson,
Alan H. (JSC-SK311)
Sent: 10 December 2008 19:17
Subject: st: argument string with embedded comma

Hi I know this has come up before, but I can't find it on the Stata
FAQ's or with -findit-. If a character string as an argument has a comma
embeded in it, how can I process it correctly? For example in,

args a
noi di "`a'"

. run temp "ddfgdsf"
. run temp "ddfg,dsf"
option dsf not allowed

But on the other hand, interactively:

. local blah "dsfgd,dsgdfg"

. di "`blah'"

Why does this work interactively, but not as an argument in a .do file?

Al Feiveson

*   For searches and help try:

*   For searches and help try:

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