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 (March 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 9 Mar 2001 11:29:34 -0800
Reply-To:     "Huang, Ya" <ya.huang@AGOURON.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Huang, Ya" <ya.huang@AGOURON.COM>
Subject:      Re: Testing for Formats
Comments: To: "Chakravarthy, Venky" <Venky.Chakravarthy@pfizer.com>
Content-Type: multipart/alternative;

A little suggestion: there might be some other formats catlog reside under other libname. We might need to search them too, which can be done based on FMTSEARCH info.

-----Original Message----- From: Chakravarthy, Venky [mailto:Venky.Chakravarthy@PFIZER.COM] Sent: Friday, March 09, 2001 11:08 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Testing for Formats

Foster,

You can use the EXIST function and assign the value to a macro. After that the Proc format can be conditionally run based on the value returned by the macro variable. Here is my test on 6.12 NT, once BEFORE the format was assigned and once AFTER.

286 options symbolgen mlogic mprint; 287 %macro d; 288 %let e=%sysfunc(exist(work.formats,catalog)); 289 %if &e=0 %then %do; 290 proc format; 291 value t_fmt 1='Y' 292 2='N' 293 ; 294 run; 295 %end; 296 data _null_; 297 x=1; y=2; 298 format x y t_fmt.; 299 put 'x=' x; 300 put 'y=' y; 301 run; 302 %mend d; 303 304 %d MLOGIC(D): Beginning execution. MLOGIC(D): %LET (variable name is E) SYMBOLGEN: Macro variable E resolves to 0 MLOGIC(D): %IF condition &e=0 is TRUE MPRINT(D): PROC FORMAT; MPRINT(D): VALUE T_FMT 1='Y' 2='N' ; NOTE: Format T_FMT has been output. MPRINT(D): RUN;

NOTE: The PROCEDURE FORMAT used 0.05 seconds.

MPRINT(D): DATA _NULL_; MPRINT(D): X=1; MPRINT(D): Y=2; MPRINT(D): FORMAT X Y T_FMT.; MPRINT(D): PUT 'x=' X; MPRINT(D): PUT 'y=' Y; MPRINT(D): RUN;

x=Y y=N NOTE: The DATA statement used 0.02 seconds.

MLOGIC(D): Ending execution. MLOGIC(D): Beginning execution. MLOGIC(D): %LET (variable name is E) SYMBOLGEN: Macro variable E resolves to 1 MLOGIC(D): %IF condition &e=0 is FALSE 305 %d MPRINT(D): DATA _NULL_; MPRINT(D): X=1; MPRINT(D): Y=2; MPRINT(D): FORMAT X Y T_FMT.; MPRINT(D): PUT 'x=' X; MPRINT(D): PUT 'y=' Y; MPRINT(D): RUN;

x=Y y=N NOTE: The DATA statement used 0.05 seconds.

MLOGIC(D): Ending execution.

-----Original Message----- From: Kerrison, Foster [mailto:FKerrison@NT.DMA.STATE.MA.US] Sent: Friday, March 09, 2001 12:48 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Testing for Formats

If I run a job with the same format twice I get the message that the format already exists. What I am wondering is can I test if the format exists as part of the job and if it does then skip the step that "recreates" it. Anyone know if this is possible?

Thanks,

Foster Kerrison


[text/html]


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