Since you never actually call the macros, all your SAS system ever "sees" is OPTIONS MPRINT MLOGIC SYMBOLGEN SPOOL MACROGEN; DATA _NULL_; OPTIONS MPRINT MLOGIC SYMBOLGEN SPOOL MACROGEN; - keep your scopes in line (eg. if the DATA statement is outside a macro, the associated RUN should also be outside, and vice versa) - the macro processor is a generator of program text, it does NOT execute any statements. In your second macro, you have a completely meaningless statement: %if devmntmx > &THMVDEV %then %do ; output bvir_base; %end; In case the condition is not met, no output statement is generated. In that case, the data step will always output to the dataset named in the DATA statement, which also is bvir_base! But the condition will always be met, because the letter "d" is always higher in the collating sequence than any number. You most probably do not need the second macro at all, just do a standard data step comparison of devmntmx to &THMVDEV What you wanted to do looks like this to me: %let THMVDEV=any value that you want to test for; Data bvir_base; set pdb.bvir; where devmntmx > &THMVDEV; attrib cluster label='Cluster*id' ; attrib dlibseqn label='Dist Lib Seq num' ; attrib glibseqn label='Grid Lib Seq num' ; attrib machserl label='Machine Serial' ; attrib vdevinst label='Virt Dev Installed' ; attrib devmntav label='Avg Virt Dev Mounted' ; attrib devmntmx label='Max Virt Dev Mounted' ; attrib devavgdl label='Device Average Delay' ; attrib devmaxdl label='Device Maximum Delay' ; attrib devintdl label='Device Interval Delay %' ; * Thresh_Max_Vdev = 70; * Thresh_Max_Vdel = 10 ; Date = datepart(startime) ; Time = timepart(startime) ; format date date7. time time5. ; machserl = substr(machserl,4,5) ; run;
... View more