Statalist


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

st: generate an error message if the wrong number of args is given following the args command


From   Nathan Danneman <ndanneman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: generate an error message if the wrong number of args is given following the args command
Date   Mon, 29 Jun 2009 12:51:26 -0400

Hi all,

I have written a program, which utilizes the args command.  The
program analyzes regression results, and requires the user to input a
single constant.  Is there a way to generate an error message if the
user inputs an incorrect number of arguments (either none, or more
than one)?

Here is what the program looks like...

capture program drop example
program example
	version 10.1
	args factor
** I would like to input a line here that would do something like (if
number of args != 1, then error "wrong number of arguments")
...
...

end

Thanks,
ND

-- 
"Imagination is more important than knowledge..."
      -- Albert Einstein
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index