[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Jun Xu" <mystata@hotmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
RE: st: weight option after syntax |

Date |
Mon, 26 Sep 2005 15:51:59 -0500 |

Nick and Scott, Thanks again! Jun Xu Ph.D. Candidate Department of Sociology Indiana University at Bloomington

_________________________________________________________________From: "Nick Cox" <n.j.cox@durham.ac.uk> Reply-To: statalist@hsphsun2.harvard.edu To: <statalist@hsphsun2.harvard.edu> Subject: RE: st: weight option after syntax Date: Mon, 26 Sep 2005 10:29:44 +0100 Otherwise put, the implication of namelist is that a namelist is required. You evidently regard it as optional, which would be specified by [namelist] Nick n.j.cox@durham.ac.uk Scott Merryman > I suspect the problem is that "namelist" requires that the > names listed use > the standard naming convention and names cannot begin with > "[" If you use > the "if" option then parser knows that what follows cannot be part of > "namelist" > > > One alternative is to use "anylist" > > program mycmd, rclass byable(recall) > version 9.1 > syntax anything [if] [in] [pweight] > gettoken subcmd anything: anything > gettoken lhs anything: anything > loc rhs `anything' > di in r "`subcmd'" > di in r "`lhs'" > di in r "`rhs'" > di in r "`weight'" > di in r "`exp'" > end > > Which now works: > > > . mycmd fubar price mpg weight [anyhoo = (American) anyhow] > [pw = fore] > fubar > price > mpg weight [anyhoo = (American) anyhow] > pweight > = fore Jun Xu > Sorry that I forgot to mention that I am using Stata 9.1. > > >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 > > >****** * * 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/

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/

**References**:**RE: st: weight option after syntax***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: Labelling part of graph axis?** - Next by Date:
**Re: st: png Graph Problem** - Previous by thread:
**RE: st: weight option after syntax** - Next by thread:
**st: heckman/dataset issue** - Index(es):

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