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

From |
"Michael Blasnik" <michael.blasnik@verizon.net> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: Re: Pass Integers to Program |

Date |
Sun, 17 Feb 2008 18:59:55 -0500 |

...

It would be easiest to make this a "required" option because you could then use the numlist syntax.

syntax ..., values(numlist min=1 max=49 integer ascending)

To check that there are exactly 6 arguments, you could then code:

local nints: word count `values'

if `nints'!=6 {

noi di as err "values option must contain 6 integers"

exit 198

}

The ascending option requires that the numlist be ascending, but you could specify the sort option to make it automatically sorted.

Michael Blasnik

----- Original Message ----- From: "Martin Weiss" <martin.weiss@uni-tuebingen.de>

To: <statalist@hsphsun2.harvard.edu>

Sent: Sunday, February 17, 2008 6:22 PM

Subject: st: Pass Integers to Program

Hi guys, this may be easy for the advanced Stata users typically populating the Statalist, but I have now spent the better part of the afternoon trying to pass six integers as mandatory arguments to a program, and then have the program check whether there are six integers, in ascending order (if not, please sort), greater than zero and smaller than 50. I subsequently want to refer to them as arg1, arg2... I understand this is possible with positional arguments, but I do not know how to check for completeness and ascending order then. So I have been reading -syntax- in the [U]Programming up and down all day, but this explanation, though stretching over pages, has left me even more clueless as to the correct specification. Particularly worrying is the part where they refer to "anything" on page 411, where, in my view, the whole description is not intelligible. I addition, there are no real examples in this part of the handbook. Man, I am looking forward to a good book on Stata programming... Thanxx for any ideas in advance, Martin Weiss

* * 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/

**Follow-Ups**:**Re: st: Re: Pass Integers to Program***From:*Maarten buis <maartenbuis@yahoo.co.uk>

**References**:**st: Pass Integers to Program***From:*"Martin Weiss" <martin.weiss@uni-tuebingen.de>

- Prev by Date:
**st: RE: ST: Zero Inflated Poisson model for panel data** - Next by Date:
**st: RE: RE: Exact Poisson Regression** - Previous by thread:
**st: Pass Integers to Program** - Next by thread:
**Re: st: Re: Pass Integers to Program** - Index(es):

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