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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

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

Subject |
st: RE: unexpected "ambiguous abbreviation" |

Date |
Wed, 27 Feb 2008 11:07:09 -0000 |

On a different note, your program reminds me of -nbfit- on SSC, written by Roberto Gutierrez and friend. As the friend in question, I am interested to know what you are doing that is different. Perhaps -nbfit- should support it. Your program starts something like this. I am omitting details irrelevant to the points I am going to make. program fitnb version 9 syntax [varlist] [, maxval(integer 0)] tokenize `varlist' args x if `maxval' == 0 local selection "if `x' < ." else local selection "if `x' < . & `x' <= `maxval'" sum `x' `selection' First, it seems that you want to feed this a single variable. program fitnb version 9 syntax varname(numeric) [, maxval(integer 0)] local x `varlist' if `maxval'==0 local selection "if `x'<." else local selection "if `x' < . & `x' <= `maxval'" sum `x' `selection' is then a cleaner way to start that will trap some kinds of inappropriate input. Second, stipulating within your program -if `x' < .- is redundant in the case of commands like -summarize- or -nbreg- which automatically omit observations that are missing. What -maxval()- does, as far as your visible code is concerned, can be done easily and directly if your program supports -if-. (Adding -in- does no harm either.) program fitnb version 9 syntax varname [if] [in] marksample touse qui count if `touse' if r(N) == 0 exit 2000 local x `varlist' sum `x' if `touse' Then you can call with fitnb foobar if foobar <= 20 Or whatever. Nick n.j.cox@durham.ac.uk Dirk Enzmann [...] * * 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**:**st: unexpected "ambiguous abbreviation"***From:*Dirk Enzmann <dirk.enzmann@uni-hamburg.de>

- Prev by Date:
**Re: st: RE: unexpected "ambiguous abbreviation"** - Next by Date:
**st: Survival analysis gurus** - Previous by thread:
**st: RE: unexpected "ambiguous abbreviation"** - Next by thread:
**st: aligned rank test** - Index(es):

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