Differences between revisions 2 and 3
Revision 2 as of 2025-10-24 16:35:52
Size: 495
Comment: Rewrite
Revision 3 as of 2025-10-24 16:52:01
Size: 497
Comment: Rewrite
Deletions are marked like this. Additions are marked like this.
Line 31: Line 31:
[[https://www.stata.com/manuals/dassert.pdf|Stata manual for assert]] [[https://www.stata.com/manuals/dassert.pdf|Stata manual for -assert-]]

Stata Assert

-assert- raises an error if a condition is not true.


Usage

assert foo==1
assert foo==1 if bar==1

-assert- can also be used with macros, scalars, and stored results.

count if foo==1
assert r(N)==0


See also

Stata manual for -assert-


CategoryRicottone

Stata/Assert (last edited 2025-10-24 16:52:01 by DominicRicottone)