BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
K_HARI__PRASAD
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
In the options menu click open results as generated.

View solution in original post

21 REPLIES 21
Jagadishkatam
Amethyst | Level 16
Just try

PROC SQL;
SELECT a,b,c FROM XYZ;
QUIT;

No proc print required.
Thanks,
Jag
K_HARI__PRASAD
Calcite | Level 5
I tried, but still the same result. It's not printing.
Thank you.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

K_HARI__PRASAD
Calcite | Level 5
I don't want to create a file with the select query result. I just want to display the results. Even I am unable to print permanent or work library datasets.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Reeza
Super User
Are you using SAS Base installed? If so, it's possible you closed the output window by accident. Go to view and results to see the output window again.
K_HARI__PRASAD
Calcite | Level 5
I am using SAS EG. I just tried to print data set (work or permanent lib) /select query. It's not printing 🙂
Reeza
Super User
Post your code and the log.
K_HARI__PRASAD
Calcite | Level 5
Hi Reeza,

My code
---------------------------
data abc;
input e f g;
infile datalines;
datalines;
1 2 3
4 5 6
7 8 9
;
run;

proc print data=abc;
run;

--------------------------------

LOG
*********************************
16 GOPTIONS ACCESSIBLE;
17 data abc;
18 input e f g;
19 infile datalines;
20 datalines;

NOTE: Compression was disabled for data set WORK.ABC because compression overhead would increase the size of the data set.
NOTE: The data set WORK.ABC has 3 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

24 ;

25 run;
26
27 proc print data=abc;
28 run;

NOTE: There were 3 observations read from the data set WORK.ABC.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds


29
30 GOPTIONS NOACCESSIBLE;

**************************************************
Reeza
Super User
Go to Options and Results tab, ensure that the a Result type is selected. If that doesn't work, you'll need to contact SAS Tech Support.
K_HARI__PRASAD
Calcite | Level 5
hI Reeza,

I selected Results as SAS Report, HTML formats. But still the result is not displyed in the out put window.

Thanks for your time.
K_HARI__PRASAD
Calcite | Level 5
@RW9 :I want to print the results in output window
RW9
Diamond | Level 26 RW9
Diamond | Level 26
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).

dkb
Quartz | Level 8 dkb
Quartz | Level 8

After you run the code, does your EG process flow look something like this?

 

 

EG_Results.PNG

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 21 replies
  • 2167 views
  • 1 like
  • 5 in conversation