Statalist


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

st: Re: saved local macro


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: Re: saved local macro
Date   Fri, 31 Oct 2008 08:42:22 +0100

Try it with a -scalar-:


********
program cu8, rclass
local numd 1
ret sca numd =`numd'
end
********

HTH
Martin _______________________ ----- Original Message ----- From: "Paul O'Brien" <[email protected]>
To: "statalist" <[email protected]>
Sent: Friday, October 31, 2008 8:34 AM
Subject: st: saved local macro


i have a small program cu7 with a saved local macro:
program cu7, rclass
local numd 1
return local numd =`numd'
end

but using the program in an ado:
cu7
if r(numd) == 1 {
display r(numd)
}

i get:
. cu7
. if r(numd) == 1 {
type mismatch

yet this works:
local numd  1
if `numd' == 1 {
display `numd'
}

. local numd  1
. if `numd' == 1 {
. display `numd'
1
. }

and Stata is interpreting numd as 1:
. cu7
. display r(numd)
1
. return list
macros:
               r(numd) : "1"

where am i going wrong?

thanks,

paul
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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