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: SAS Command for Stata's Assert Command


From   Sergiy Radyakin <[email protected]>
To   [email protected]
Subject   Re: st: SAS Command for Stata's Assert Command
Date   Mon, 29 Nov 2010 21:18:01 -0500

On Mon, Nov 29, 2010 at 8:55 PM, Bob Sutter <[email protected]> wrote:
> Is there a SAS command that functions like Stata's assert command? Thanks.
>

Why not substitute it with (humanly-speaking):
if (something is_not_equal_to something_else) then abort with error

I believe something like this could work in SAS:


%let abort=0;

....... here determine the value of myvalue to be tested

%if &myvalue > 4 %then %let abort=1;
%if &abort %then %goto DONE;

....... continue with your program, assert is passed here

%done:
%if &abort %then %put ERROR: Assert failed.;


Best, Sergiy Radyakin

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