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

st: xt: Parsing a varlist in a stata command's options


From   [email protected]
To   [email protected]
Subject   st: xt: Parsing a varlist in a stata command's options
Date   Fri, 10 Dec 2004 09:12:46 -0500

Dear all,

I have a personal ado that compiles a series of results in a matrice.

So far, my program has 3 otptions.

syntax varlist  [if] [in] [aweight fweight] [, g1(varname) g2(varname)
g3(varname)]

and is working fine. Off course, I could keep expanding my options by g4 g5,
etc.
But it would be tiduous.

I want to generalize the options to something like:

prog Myprog
syntax varlist  [if] [in] [aweight fweight] [, BYGroup([varlist2])]
tokenize `varlist'
...
while "`1'"~="" {
   ...
   if  "`bygroup'" ~="" {
        tokenize `varlist2'
       ....
   }
}

So that at the end, my command will just be :

Myprog x1 x2 x3, by(V1 V2 V3 V4 V5 V6)

But it is not working.
How to generalize the options so that I will not limit myself ?

Thanks.
Amadou

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