Help using Base SAS procedures

Handling error

Reply
Contributor
Posts: 38

Handling error

Hi All,

When am executing the below code .

If the store(Member) is not present in the pds file('xo94.control.parm') it is failing with member not found .

Could you please help us how to avoid that error if the member is not found .

I can have a display message saying the member not found instead of failing.

FILENAME model'XO94.SAS.MODELID';

FILENAME rr'XO94.store';

data rename1;                                   

infile model;                                   

input store £;                                  

length ftrw £30.;                               

ftrw1 ='xo94.control.parm('||trim(store)||')';  

infile dummy filevar=ftrw1 sharebuffers end=done;

FILE DUMMY FILEVAR=FTRW1;                       

do until(done);                                 

input @1 renam £100.;                           

%INCLUDE rr;     //-- renam=tranwrd (renam,'2205','6453');---

put renam;                                      

end;                                            

run;                                            

Thanks,

Siva.

Respected Advisor
Posts: 3,780

Re: Handling error

You will need to test if the value contained in FTRW1 exists.  Using either FEXIST or FILEEXIST.  I don't know which would be "best" given your OS and the value contain in FTRW1.  The following paper covers the subject will enough but does not specifically address your OS which I think is z/OS.

http://www2.sas.com/proceedings/sugi31/029-31.pdf

Check out the functions in the online docs, it will basically be something like...

ftrw1 ='xo94.control.parm('||trim(store)||')'; 

if FILEEXIST(FTRW1) then do;

   putlog  'NOTE: File ' ftrw1 'does not exist';

   delete;

   end;

Contributor
Posts: 38

Handling error

Hi,

Its not working .is this the logic for  PDS member too.

Thanks.

SIva.

Respected Advisor
Posts: 3,780

Re: Handling error

You will need to consult your OS specific documention.  As I said it goes "something like this".

Look a FEXIST function.  You will need to create a tempory FILEREF with the FILENAME function then test using FEXISTS.  It's all in the documentation.

Ask a Question
Discussion stats
  • 3 replies
  • 181 views
  • 0 likes
  • 2 in conversation