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

st: Re: options in .ado files


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: options in .ado files
Date   Thu, 21 Jul 2005 14:17:32 -0400

Please state the actual problem -- does Stata issue an error when executing the -if-, or is there some later problem that results in an error or mistaken result?

I would guess that the problem is that the if statement assigns a value to a scalar named t, but if the t() options is used, it assigns a numlist to a local macro named t. Therefore, if your code references `t', it won't see the scalar (which is t, not `t'). Perhaps the statement inside the if should be:

local t "1000"

Michael Blasnik
[email protected]

----- Original Message ----- From: "NEYMOTIN, FLORENCE" <[email protected]>
To: <[email protected]>
Sent: Thursday, July 21, 2005 2:03 PM
Subject: st: options in .ado files



Hi, I have the user entering a string of numbers as an OPTION in a .ado file, but for some reason, the code I wrote for when the user does NOT enter the string is not working. In this case, I have :

syntax varlist, [t(numlist)]

and then...

if "`t'"== "" {
scalar t=1000
}
else {
...
}

for some reason, it doesn't like the way that I defined the if statement.
any suggestions would be appreciated.
thanks,
Florence
*
*   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