LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 1 Dec 2009 13:39:25 -0800
Reply-To:   xlr82sas <xlr82sas@AOL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   xlr82sas <xlr82sas@AOL.COM>
Organization:   http://groups.google.com
Subject:   =?windows-1252?Q?Re=3A_Error_Handling_=E2=80=93_Data_Sets?=
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=windows-1252

On Dec 1, 12:36 pm, r...@CDC.GOV ("Fehd, Ronald J. (CDC/CCHIS/NCPHI)") wrote: > > From: SAS Swamy > > Subject: Error Handling – Data Sets > > > Hello, > > > I haven’t done any Error handling so far in SAS , > > If I am looking for a specific data set in a folder , and If > > the data set > > does not exist , can I raise an exception ? > > Also, being that the main or Base data set , I would not be able to > > proceed without that data set, in a way I need to stop all > > the processing > > if the data set does not exist and come out of the processing > > , and write > > something like ‘Data Set not found’ in the output file. > > > Can someone please help me. > > > Thanks > > - Swamy > > here is a page with some tricks to do what you want: > > To refer to this page use:http://tinyurl.com/25ba6l > > http://www.sascommunity.org/wiki/Conditionally_Executing_Global_State... > > Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov- Hide quoted text - > > - Show quoted text -

Hi SAS-Lers,

Nice exhaustive list of methods on Wiki.

I think Chang Chung's excellent techiques below may be better for macro variables.

for a cleaner version see:

T003920 EXCEPTION HANDLING FOR MACRO ARGUMENTS at

http://homepage.mac.com/magdelina/.Public/utl.html utl_tipweb.txt

%macro utl_aestartdate

( aeany = aeany ,_cycdate_ = dtecyc ,aestartc = aestdtc /* has to be ISO 1997-09-13 or 1997-04 */ ,aestart = aestdt /* SAS AE start date - should ahve some missing values */ ,enrolldate = enrolldt ,firstdose = fdosedt ,aeverbatim = aeterm ,chemodates = beg0dt beg1dt beg2dt beg3dt beg4dt ,imputedate = amgendate /* variable name for new imputed start date */ ) / des ="Impute missing ae dates using partial or missing dates";

%put %sysfunc(ifc(%sysevalf(%superq(aestartc)=,boolean),**** Please Provide aestartc ISO Character Date ****,)); %put %sysfunc(ifc(%sysevalf(%superq(aestart)=,boolean),**** Please Provide aestart SAS AE start Date ****,)); %put %sysfunc(ifc(%sysevalf(%superq(enrolldate)=,boolean),**** Please Provide enrolldate Enrollnemt Date ****,)); %put %sysfunc(ifc(%sysevalf(%superq(firstdose)=,boolean),**** Please Provide firstdose First Dose Date ****,)); %put %sysfunc(ifc(%sysevalf(%superq(aeany)=,boolean),**** Please Provide aeany Any AE Flag ****,)); %put %sysfunc(ifc(%sysevalf(%superq(imputedate)=,boolean),**** Please Provide imputedate Name for imputed date ****,)); %put %sysfunc(ifc(%sysevalf(%superq(aeverbatim)=,boolean),**** Please Provide aeverbatim Raw Term ****,)); %put %sysfunc(ifc(%sysevalf(%superq(chemodates)=,boolean),**** Please Provide chemodates List of cycle dates ****,));

%if %eval ( %sysfunc(ifc(%sysevalf(%superq(aestartc)=,boolean),1,0)) + %sysfunc(ifc(%sysevalf(%superq(aestart)=,boolean),1,0)) + %sysfunc(ifc(%sysevalf(%superq(enrolldate)=,boolean),1,0)) + %sysfunc(ifc(%sysevalf(%superq(firstdose)=,boolean),1,0)) + %sysfunc(ifc(%sysevalf(%superq(aeany)=,boolean),1,0)) + %sysfunc(ifc(%sysevalf(%superq(imputedate)=,boolean),1,0)) + %sysfunc(ifc(%sysevalf(%superq(aeverbatim)=,boolean),1,0)) + %sysfunc(ifc(%sysevalf(%superq(chemodates)=,boolean), 1,0)) ) eq 0 %then %do;

... end;


Back to: Top of message | Previous page | Main SAS-L page