Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: parmby if=exp for strings


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: parmby if=exp for strings
Date   Wed, 14 Jul 2004 13:55:29 -0400

THe problem here, I wager, is that you've got quotation marks within quotation marks, without using compound quotation marks. This should work:

parmby `"stcox var1 var2 if inlist(var3, "string1", "string2")"'

Note the `" to begin the overall stcox command, and "' to end it. This lets Stata know which open-quote goes with which close-quote.

-Nick Winter


At 10:41 AM 7/14/2004 -0700, you wrote:

Hi,

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?

Thank you for your help!

Cheers,

Douglas


*
*   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/
--------------------------------------------------------
Nicholas Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government [email protected] e
308 White Hall falcon.arts.cornell.edu/nw53 w
Cornell University
Ithaca, NY 14853-4601

*
* 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/




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