| Date: | Thu, 5 Jun 2008 07:07:21 -0500 |
| Reply-To: | Gregg Snell <sas-l@DATASAVANTCONSULTING.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Gregg Snell <sas-l@DATASAVANTCONSULTING.COM> |
| Subject: | Re: raise an error if libname fails? |
| In-Reply-To: | <20ed9c08-ea47-48e5-9e5f-01b2dfacdd9f@27g2000hsf.googlegroups.com> |
| Content-type: | text/plain; charset=KOI8-R |
Perhaps use the ABORT statement?
http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000230210.htm#a00
0851856
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Paige
Miller
Sent: Thursday, June 05, 2008 6:58 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: raise an error if libname fails?
On Jun 5, 5:02 am, JĊns MÁrtin SchlÁttĊr <KmoEfrUew...@spammotel.com>
wrote:
> I have a batch job which needs a lot of libnames.
> Before processing begins, I want to test if the libname (data set) is
> available (on the mainframe).
>
> Therefore, I'd like to have a macro like this:
>
> %macro test_alloc(dsname);
> libname pd &dsname disp=shr;
> %if &syslibrc ne 0 %then ???;
> libname pd clear;
> %mend;
>
> But which action should I do in the %then statement to prevent further
> processing AND signaling an error? Of course "endsas" is not adequate.
>
> JMS
%if &syslibrc ne 0 %then %do;
/* Signal the error code here */
%end;
%else %do;
libname pd clear;
%end;
--
Paige Miller
paige\dot\miller \at\ kodak\dot\com
|