Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Strange behaviour with passing parameters to a Stata program


From   "Salah Mahmud" <[email protected]>
To   [email protected], [email protected]
Subject   st: Strange behaviour with passing parameters to a Stata program
Date   Sat, 12 Jul 2008 23:44:24 -0500

Stata completely ignores the notab parameter when it is passed to the
program below.
On tracing, notab is always =="" no matter what. Change the parameter
name in the syntax statement to anything else and it works as
expected. Anybody knows what is going on?

I'm running Stata MP v10  born 27 May 2008

Thanks,



cap program drop smtgen
program define smtgen
syntax anything[, Gen(string) Label(string) VLabel(string) replace notab ]
tempvar v
gen `v'=`anything'
local tt "`v'"
if "`gen'" != "" {
 if "`replace'" != "" {
       cap drop `gen'
 }
 rename `v' `gen'
 if "`label'" != "" {
    labe var `gen' "`label'"
 }
 if "`vlabel'" != "" {
    labe val `gen' "`vlabel'"
 }
 local tt "`gen'"
}
if "`notab'" == "" {
 tab `tt'
}
end
*
*   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