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

From |
Maarten buis <maartenbuis@yahoo.co.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: AW: st: Re: Pass Integers to Program |

Date |
Mon, 18 Feb 2008 09:56:49 +0000 (GMT) |

--- Martin Weiss <martin.weiss@uni-tuebingen.de> wrote: > thanxx for the advice but what goes for the dots in "syntax..., > values"? I really cannot get this to work, everytime I try it, I get > error codes r(197) and r(198)... ... could be a lot of things described in -help syntax-, and since we did not know what kind of program you were writing we just left that open by typing ... It could be nothing at all, but often it is something like this: syntax varlist [if] [in] [fw aw pw] , /// values(numlist min=6 max=6 >0 <50 sort integer) In which case someone must enter a list variables and your list of 6 integers, and one can use -if- -in- and weights (fweights, aweights, or pweights). If you want to allow for -if- and -in-, it is useful to take a look at -help mark-. If All you want is to pass the six integers, you can type: syntax , values(numlist min=6 max=6 >0 <50 sort integer) The example below illustrates some of the useful features of -syntax- in a working example. Hope this helps, Maarten *--------------- begin example ------------------- capture program drop foo program define foo syntax varlist [if] [in] [aw], /// VALues(numlist min=6 max=6 >0 <50 sort integer) /// [ /// red /// ] local wgt "[`weight'`exp']" marksample touse sum `varlist' if `touse' `wgt' di _n as txt "the values specified in the option values are:" if "`red'" == "" { di as result "`values'" } else { di as err "`values'" } end sysuse auto, clear foo mpg if foreign==1 [aw=weight] , val( 1 4 5 2 3 9) foo mpg , val( 1 4 5 2 3 9) red *----------------- end example ------------------------ (For more on how to use examples I sent to the Statalist, see http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html ) ----------------------------------------- Maarten L. Buis Department of Social Research Methodology Vrije Universiteit Amsterdam Boelelaan 1081 1081 HV Amsterdam The Netherlands visiting address: Buitenveldertselaan 3 (Metropolitan), room Z434 +31 20 5986715 http://home.fsw.vu.nl/m.buis/ ----------------------------------------- __________________________________________________________ Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com * * 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**:**AW: st: Re: Pass Integers to Program***From:*"Martin Weiss" <martin.weiss@uni-tuebingen.de>

- Prev by Date:
**AW: st: Re: Pass Integers to Program** - Next by Date:
**st: how to use ztnb?** - Previous by thread:
**AW: st: Re: Pass Integers to Program** - Next by thread:
**Re: st: Re: Pass Integers to Program** - Index(es):

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