Thanks Nick, I have read but little understood the quotation nesting
guidelines.
I tried your suggestion, but when I surround the double quotes with `' the
command is not executed. And when I tried the same on the quotes for the
two string variables (e.g. inlist(var3, `"string1"', `"string2"')) it said
"too few quotes").
I can get the results I need with by encoding the string variable, but if
you see my error it may really help in the future (and simplify these do
files as well).
Thanks again,
Douglas
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: Wednesday, July 14, 2004 10:47 AM
To: [email protected]
Subject: st: RE: parmby if=exp for strings
My guess is that this is nothing to do with -parmby-.
The Stata parser can't understand your nesting. I'd
try `" "' for the outer quotes.
parmby `"stcox var1 var2 if inlist(var3, "string1", "string2")"'
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Douglas
> Crawford
>
> I am performing a series of parmby's for stcox analyses. In
> my hands, I
> have found that _if_ only accepts numeric expressions:
>
> stcox var1 var2 if inlist(var3, "string1", "string2")
>
> works just fine, but
>
> parmby "stcox var1 var2 if inlist(var3, "string1", "string2")",
> saving(parms1.dta)
>
> does not work, I get the following error message:
>
> varlist not allowed
> r(101);
>
> However I can get around this problem by converting the
> string variable to a
> numeric one:
>
> encode var3, gen(var3_nu)
> parmby "stcox var1 var2 if inlist(var3_nu, 1, 2)", label eform
> saving(parms1.dta)
>
> works just fine
>
> Is there a general rule about the use of =exp for strings
> that I am not
> aware of?
*
* 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/
*
* 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/