DATA Step, Macro, Functions and more

proc print not printing anything

Reply
Contributor
Posts: 41

proc print not printing anything

When I read a dataset, it displays the contents in the output window correctly:

libname abc "dataset path";
data xyz;
set abc.wf91;
run;

 

but then when I give this command, it just takes me to the log window and displays nothing. No errors though, what am I doing wrong?

proc print data=xyz(obs=5);
run;

 

Thank you for helping!

Super User
Super User
Posts: 9,599

Re: proc print not printing anything

Posted in reply to astha8882000

I am sorry, I do not follow?  Running a datastep should not display the contents of that dataset in the output window?  What software are you using, e.g. SAS 9.4, Enterprise Guide, Visual Analytics etc.  and exactly what code are you running - show the exact code, use sashelp.class if possible so we can run it as well e.g:

data xyz;
  set sashelp.class;
run;
proc print data=xyz(obs=5);
run;

This should give you some notes in the log that the datastep and print worked.  And in the output should be the output of the pro print.

Contributor
Posts: 41

Re: proc print not printing anything

[ Edited ]

I'm using SAS EG, this is the exact code that I was running (can't display the path due to confidentiality purposes):

First I ran this:

libname abc "path of the dataset";
data xyz;
set abc.wf_bl91;
run;

 

which displayed the dataset in the o/p window. Then I ran this:

proc print data=xyz(obs=5);
run;

which only produces logs with no warnings or errors, but no output.

 

 

Super User
Super User
Posts: 9,599

Re: proc print not printing anything

Posted in reply to astha8882000

Lets start over.  Start a new session.  In your code window put the code:

ods listing;
data xyz; set sashelp.class; run;
proc print data=xyz(obs=5);
run;

Run this.  In the log you should see the above code with some notes after each block indicating how many records read. 

1322       data xyz;
1323         set sashelp.class;
1324       run;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.XYZ has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1325       proc print data=xyz(obs=5);
1326       run;

NOTE: There were 5 observations read from the data set WORK.XYZ.
NOTE: The PROCEDURE PRINT printed page 2.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

Open the output window, you should see:

The SAS System 14:50 Monday, June 18, 2018 2

Obs Name Sex Age Height Weight

1 Alfred M 14 69.0 112.5
2 Alice F 13 56.5 84.0
3 Barbara F 13 65.3 98.0
4 Carol F 14 62.8 102.5
5 Henry M 14 63.5 102.5

Super User
Posts: 10,214

Re: proc print not printing anything

Posted in reply to astha8882000

Please post the log. This code

data xyz;
set sashelp.class;
run;

proc print data=xyz(obs=5);
run;

produces this result:

Obs     Name      Sex    Age    Height    Weight

  1    Alfred      M      14     69.0      112.5
  2    Alice       F      13     56.5       84.0
  3    Barbara     F      13     65.3       98.0
  4    Carol       F      14     62.8      102.5
  5    Henry       M      14     63.5      102.5

just as expected.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Contributor
Posts: 41

Re: proc print not printing anything

Posted in reply to KurtBremser

I tried running your code, all at once and one after another ((first the data set and then the proc print), and it shows the same result.

But for my code, when I run it together only then it gives the result in the result window, when I run those separately then the first part produces the dataset in the output window and when I run the proc print, I just get the logs with no errors or warnings.

Super User
Posts: 13,508

Re: proc print not printing anything

Posted in reply to astha8882000

1) Run your code

2) Go to the log

3) COPY the code and any messages from the log

4) Paste into a code box opened using the forum {i} menu icon as @RW9 did.

 

That we can confirm 1) that the library was successfully created, 2) the actual code you submitted, 3) the number of records in the resulting work.xyz data set and 4) any messages from Proc Print.

Respected Advisor
Posts: 2,989

Re: proc print not printing anything

[ Edited ]
Posted in reply to astha8882000

Is it possible that somehow the ODS LISTING destination has been closed? In that case, nothing would be written to the OUTPUT window, but there could be a WARNING (not an ERROR) in the SASLOG. What happens if you include the command 

 

ods listing;

at the top of your program, and then run it?

--
Paige Miller
SAS Super FREQ
Posts: 9,365

Re: proc print not printing anything

Posted in reply to PaigeMiller
Hi:
If you are running your code in Enterprise Guide, by default, Enterprise Guide will show you any output data sets in the Data Table window. So it is likely that your DATA step program is successfully making the data and then EG is opening the table to show it to you.

The reason PROC PRINT might not be showing you any output has to do with your EG settings. Under Tools --> Options --> Results General you have to be sure that one of the result destinations is turned on with a checkmark. Usually SASReport is turned on. Otherwise, check in your SAS Log, if you see a message "No output destinations active" for the PROC PRINT step, you might need to pick an output type for your results in the Options window.

Cynthia
Ask a Question
Discussion stats
  • 8 replies
  • 100 views
  • 0 likes
  • 6 in conversation