BookmarkSubscribeRSS Feed
jaliu
Quartz | Level 8

For example, if i run the code below, the default 'output data' is a temporary file (library temp0, not work), not the permanent file. Since I have only referenced the cert library, why is it outputting to this extra library and what is it? To be clear, the cert library file is also available in the output -- the output has two files, but the right one is not the default. I tried print without referencing the data set and I get the same output.

 

 

DATa cert.penngolf ;
set '/home/u49936438/sasuser.v94/penngolf.sas7bdat';

Bogey = 0.186*Slope + USGA ;
label Bogey = 'Bogey Rating'
USGA = 'USGA Rating'
Slope = 'Course Slope'
Par = 'Course Par'
Yards = 'Total Yardage';
format Bogey 4.1 Yards comma5.;
RUN;

PROC PRINT data = cert.penngolf NOOBS ;
title 'The penngolf data set';
var Name Yards Par Slope USGA Bogey;

RUN;

4 REPLIES 4
Reeza
Super User
Show the log and please explain why you think it's referncing the temp0 library?
I could see your original data set, penngolf.sas7bdat ending up in a temp0 library if you double clicked the file and it opened there, but from the code you've shown that shouldn't happen with the cert.penngolf dataset. I would also recommend giving the data sets different names so you can track them more clearly, if they have the same name exactly, how do you identify which one you're referencing?

FYI I would have expected your code to be:

libname myData '/home/u49936438/sasuser.v94/';

data cert.penngolf2;
set myData.penngolf;
run;
jaliu
Quartz | Level 8
Well, that is the name of the default output data table rather than the cert.penngolf so that's how I know:

jaliu_1-1629830675929.png

 

 

***
LOG:
 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 DATa cert.penngolf ;
70 set '/home/u49936438/sasuser.v94/penngolf.sas7bdat';
NOTE: Data file SASUSER.PENNGOLF.DATA is in a format that is native to another host, or the file encoding does not match the
session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce
performance.
71
72 Bogey = 0.186*Slope + USGA ;
73 label Bogey = 'Bogey Rating'
74 USGA = 'USGA Rating'
75 Slope = 'Course Slope'
76 Par = 'Course Par'
77 Yards = 'Total Yardage';
78 format Bogey 4.1 Yards comma5.;
79 RUN;
 
NOTE: There were 11 observations read from the data set /home/u49936438/sasuser.v94/penngolf.sas7bdat.
NOTE: The data set CERT.PENNGOLF has 11 observations and 10 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
user cpu time 0.01 seconds
system cpu time 0.01 seconds
memory 1027.78k
OS Memory 26020.00k
Timestamp 08/24/2021 06:40:15 PM
Step Count 133 Switch Count 5
Page Faults 0
Page Reclaims 109
Page Swaps 0
Voluntary Context Switches 60
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
 
 
80
81 PROC PRINT data = cert.penngolf NOOBS ;
82 title 'The penngolf data set';
83 var Name Yards Par Slope USGA Bogey;
84
85 RUN;
 
NOTE: There were 11 observations read from the data set CERT.PENNGOLF.
NOTE: At least one W.D format was too small for the number to be printed. The decimal may be shifted by the "BEST" format.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.02 seconds
user cpu time 0.02 seconds
system cpu time 0.00 seconds
memory 1339.81k
OS Memory 26020.00k
Timestamp 08/24/2021 06:40:15 PM
Step Count 134 Switch Count 1
Page Faults 0
Page Reclaims 63
Page Swaps 0
Voluntary Context Switches 16
Involuntary Context Switches 0
Block Input Operations 288
Block Output Operations 8
 
 
86
87 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
97
 
***
 
Thanks
ballardw
Super User

 

You may have made that earlier, typically _temp libraries come from opening a data set by clicking on a file outside of SAS and the system associations create the library so SAS can display the data or referencing the set with a literal path as you did instead of library.dataset syntax. Data sets must be a library so one was created. Depending on where that file was it may also be in a defined library. More than one library can point to the same physical storage location. Which means that a data set in the library could be accesses using any of the library names. So if your CERT library happens to be the same as _temp0 physically then CERT.Penngolf is the same data set as _temp0.Penngolf and the only reason you think they are different some how is a minor misunderstanding of how Libraries work.

 

Go to your LIBRARIES in the menu. Open _TEMP0 and look at the data set. Then open Cert and look. Do the datasets look the same? Number and names and properties.

 

You may also want to try sending the output to a different data set if the _TEMP0 and CERT libraries are the same physical location because the data step completely replaced the original version of the data set.

Reeza
Super User

That's not your output data set that's the one sitting in SASUSERV9.4. Since you didn't assign it a library and are opening it directly, probably double clicking, SAS creates a temporary libname to reference it. EDIT: Or Studio is doing that because you referenced it directly via the path, not via a library. If you do it via a library that shouldn't appear. 

Like I mentioned, if you give your data sets unique names this becomes easier to see.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
LIBNAME 101

Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 689 views
  • 2 likes
  • 3 in conversation