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/