I think I must miss something important here. I am trying to write a command
that simply invokes a stata command repeatedly and collect some eret
information. The following is the very beginning part of it (also where the
problem lies), and I am having problems with the [pw] option. I inserted
display commands to check if I am getting macro's that I want. Any thoughts?
Thanks a lot!
==========================
cap program drop mycmd
program mycmd, rclass byable(recall)
version 8.0
syntax namelist [if] [in] [pw]
gettoken subcmd namelist: namelist
gettoken lhs namelist: namelist
loc rhs "`namelist'"
di in r "`subcmd'"
di in r "`lhs'"
di in r "`rhs'"
di in r "`weight'"
di in r "`exp'"
end
============================
Everytime I launch the command by specifying weight option alone, I always
get an error message. Note that lwg is a real variable name and I have a
working data set in memory.
******
. mycmd this is another issue [pw=lwg]
[ invalid name
r(198);
end of do-file
r(198);
******
However, if I work off a real data set and specify if condition before
[pw=lwg], everything works fine. Note here k5 is a real variable.
******
. mycmd this is another issue if k5==3 [pw=lwg]
this
is
another issue
pweight
= lwg
******
Jun Xu
Ph.D. Candidate
Department of Sociology
Indiana University at Bloomington