I ran into a situation where the QUIT statement is important in PROC SQL. I am running SAS 9.4 on Enterprise Guide 8.3, Update 8.
For example, if you run the two code blocks below you will get this warning message: WARNING: Output 'nlevels' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used.
proc sql;
create table CLASS AS
select *
from sashelp.class;
ods select none;
ods output nlevels=temp;
proc freq data=class nlevels;
tables _all_;
run;
If you run the same two code blocks separately, you will not get a warning message. Like Cynthia wrote above, a SAS procedure step will terminate when the beginning of the "next" DATA or PROC step is encountered. With that in mind, I inserted a data _null_ code block like below and ran all three code blocks together and I did not receive a warning message.
proc sql;
create table CLASS AS
select *
from sashelp.class;
data _null_;
x=1;
run;
ods select none;
ods output nlevels=temp;
proc freq data=class nlevels;
tables _all_;
run;
This finally led me to the solution - add QUIT at the end of the first code block. The code below runs fine:
proc sql;
create table CLASS AS
select *
from sashelp.class;
quit;
ods select none;
ods output nlevels=temp;
proc freq data=class nlevels;
tables _all_;
run;
This may have been obvious to some SAS veterans but it took me forever and a day to figure out. I am posting what I learned in case anyone else runs into a similar situation.
... View more