Help using Base SAS procedures

Unable to Print Selct Query

Accepted Solution Solved
Reply
Contributor
Posts: 36
Accepted Solution

Unable to Print Selct Query

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.


Accepted Solutions
Solution
‎12-20-2015 11:36 PM
Super User
Posts: 17,750

Re: Unable to Print Selct Query

In the options menu click open results as generated.

View solution in original post


All Replies
Trusted Advisor
Posts: 1,128

Re: Unable to Print Selct Query

Just try

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

No proc print required.
Thanks,
Jag
Contributor
Posts: 36

Re: Unable to Print Selct Query

I tried, but still the same result. It's not printing.
Thank you.
Super User
Super User
Posts: 7,392

Re: Unable to Print Selct Query

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.

Contributor
Posts: 36

Re: Unable to Print Selct Query

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.
Super User
Super User
Posts: 7,392

Re: Unable to Print Selct Query

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.

Super User
Posts: 17,750

Re: Unable to Print Selct Query

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.
Contributor
Posts: 36

Re: Unable to Print Selct Query

I am using SAS EG. I just tried to print data set (work or permanent lib) /select query. It's not printing Smiley Happy
Super User
Posts: 17,750

Re: Unable to Print Selct Query

Post your code and the log.
Contributor
Posts: 36

Re: Unable to Print Selct Query

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;

**************************************************
Super User
Posts: 17,750

Re: Unable to Print Selct Query

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.
Contributor
Posts: 36

Re: Unable to Print Selct Query

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.
Contributor
Posts: 36

Re: Unable to Print Selct Query

@RW9 :I want to print the results in output window
Super User
Super User
Posts: 7,392

Re: Unable to Print Selct Query

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).

Contributor dkb
Contributor
Posts: 53

Re: Unable to Print Selct Query

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

 

 

EG_Results.PNG

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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