SAS Command for Stata's Assert Command

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SAS Command for Stata's Assert Command

Bob Sutter
Is there a SAS command that functions like Stata's assert command? Thanks.

*
*   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/
Reply | Threaded
Open this post in threaded view
|

Re: SAS Command for Stata's Assert Command

Sergiy Radyakin
On Mon, Nov 29, 2010 at 8:55 PM, Bob Sutter <[hidden email]> 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/