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

st: weight option after syntax

From   "Jun Xu" <>
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'"



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

end of do-file

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]
another issue
= lwg

Jun Xu
Ph.D. Candidate
Department of Sociology
Indiana University at Bloomington

Donít just search. Find. Check out the new MSN Search!

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index