data example; input x $ y; datalines; a 1 c 5 run; proc sql; select * from example where x = 'c'; quit; proc sql; select * from example where x = 'd'; run; The first PROC SQL will print the result, but the second PROC SQL will print out an empty dataset. If I have dozens of these PROC SQL statements, is there a way to have the PROC SQL print out only if there is a matching record and PROC SQL like the second one not to print anything to the output window? I tried using a Having and Group By. It worked but prints out an extra CNT column. proc sql; select x, count(*) as CNT from example group by x having CNT > 0; quit; I have thought about creating a new dataset just to store the results and do another PROC SQL to get the result off that dataset. I don't think it's very efficient. Thanks in advance for your help!
... View more