Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: invalid syntax of marksample depending on option specified in preceding line for syntax?


From   László Sándor <[email protected]>
To   [email protected]
Subject   Re: st: invalid syntax of marksample depending on option specified in preceding line for syntax?
Date   Tue, 27 Mar 2012 23:09:07 -0400

Nick, again, this was very useful, thank you. For the reference too.

Laszlo

On Tue, Mar 27, 2012 at 7:32 PM, Nick Cox <[email protected]> wrote:
>
> The effect of your -weight()- option is inevitably to create a local
> macro -weight- and that is evidently being noticed by -marksample- in
> a way that you don't want. I suggest it is much simpler to use
> standard syntax to specify weights, or if you have reasons not to do
> that to use a name other than -weight-. That could include using a
> name like -weight1-, specifying that it can be abbreviated to "weight"
> by WEIGHT1(varname) and even telling the user that the name is
> -weight()- (although an experienced user might be puzzled by being
> asked to specify weights via an option).
>
> For related tricks see
>
> Cox, N.J. 2009. Stata tip 79: Optional arguments to options. Stata
> Journal 9(3): 504
>
>
> Nick
>
> 2012/3/27 László Sándor <[email protected]>:
>
> > This might be a one-liner for one of you, but I'd appreciate the help.
> > My ado file (currently tested on Stata 12.1 for Mac, but starting with
> > "version 10.1") includes the lines:
> >
> >        syntax varlist [if/] [, Weight(varname) nbins(integer 20)
> > controls(varlist) absorb(varname) x_q(varname) connect NOAddmean
> > reportreg create_xq saving(string) *]
> >        marksample touse
> >
> > Now all works fine until I try to specify a weight. Because having a
> > ", weight(w)" option (variable w exists) gives me a syntax error — but
> > not for the syntax command, but for marksample.
> >
> > Trace:
> >  - syntax varlist [if/] [, Weight(varname) nbins(integer 20)
> > controls(varlist) absorb(varname) x_q(varname) connect NOAddmean
> > reportreg create_x
> >> q saving(string) *]
> >  - marksample touse
> > invalid syntax
> >
> > What is this about?
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index