BookmarkSubscribeRSS Feed
astha8882000
Obsidian | Level 7

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!

8 REPLIES 8
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

astha8882000
Obsidian | Level 7

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.

 

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

Kurt_Bremser
Super User

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.

astha8882000
Obsidian | Level 7

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.

ballardw
Super User

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.

PaigeMiller
Diamond | Level 26

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
Cynthia_sas
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 8 replies
  • 8373 views
  • 0 likes
  • 6 in conversation