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

st: weight option after syntax


From   "Jun Xu" <mystata@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: weight option after syntax
Date   Sun, 25 Sep 2005 17:14:19 -0500

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

_________________________________________________________________
Donít just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index