Hi, I created this macro below and have been running it with datasets that contain observations, but as soon as one dataset has 0 observations that fit the criteria, it seems that the macro spits out numbers from the dataset that was run previously. Here is my code below %macro num (vorder, var); data final_&vorder; set t5; if &var ne .; run; proc summary data=final_&vorder completetypes chartype missing noprint; class outcome trt; types outcome*trt; output out=discrete; run; proc freq data=discrete; by _type_; tables outcome*trt/norow nopercent; weight _freq_/zeros; ods output crosstabfreqs_&vorder=crosstabfreqs_&vorder (where=(_type_2='01' or _type_2='11')); run; data CrossTabFreqs_&vorder /*(keep=vname rowlabel cell _level_ idlabel _type_)*/; length vname $32 rowlabel $100 cell $32 idlabel $256; set CrossTabFreqs; vname =vnamex(scan(table,2,' ')); rowlabel=vvalueX(vname); cell=cats(Frequency); format colPercent 8.1; set bign key=trt_dec/unique; idlabel=cat(strip(vvalue(trt_dec)),' ^ ',cat('(N = ',bign,')')); run; Is there a way to create another criteria that tells SAS to return nothing if there are no observations in the dataset? Thank you, any help is much appreciated!
... View more