Hi,
I tried once to PRINT select query in PROC PRINT, its worked for one time. But after the session turned off, I am unable to PRINT.
Below is the sample query.
PROC PRINT;
PROC SQL;
SELECT a,b,c FROM XYZ;
QUIT;
RUN;
Many thanks in advance.
By what do you mean "print" the query? Just putting the select will output the results directly to the output window if running interactive SAS unless you have turned that option off with:
ods noresults;
You can turn it back on with:
ods results;
If you mean you want to keep the data as a file then its a simple two step process:
extract data to a dataset then print the dataset:
proc sql; create table WANT as select A, B, C from HAVE; quit; ods rtf file="c:\results.rtf"; proc report data=want; columns _all_; run; ods rtf close;
Its very dependant on what you are doing/want which is not clear from your post.
And how do you want to display them, via file, output window? Have you tried the ods results? What about ods listing. What software are you using, is is interactive SAS or Batch.
ods listing; proc sql; select * from sashelp.cars; quit;
Then open the output window (not sure where its located as dont use EG, probably off the menu bar at the top, something like show output window).
After you run the code, does your EG process flow look something like this?
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.