Please provide information about what is considered a "SAS error" in both cases, ideally pasting part the SASLOG into your forum post reply.
Techniques for generating errors, both in a DATA step, and a macro (compilation) execution are fairly straightforward. There is an ABORT ABEND statement in SAS DATA step processing. Also, there is a SAS %ABORT statement in Macro language.
Scott Barry
SBBWorks, Inc.
SAS MACRO language DOC - %ABORT Statement
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a002475061.htm