BookmarkSubscribeRSS Feed
jc3992
Pyrite | Level 9
LIBNAME travel "&dirOUT"; 
 
data travel.golf; 
infile '/foders/myfolders/Golf.dat'; 
input CourseName $18. NumberOfHoles Par Yardage GreenFees; 
RUN;
1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         LIBNAME travel "&dirOUT";
 WARNING: Apparent symbolic reference DIROUT not resolved.
 NOTE: Library TRAVEL does not exist.
 74         
 75         data travel.golf;
 76         infile '/foders/myfolders/Golf.dat';
 77         input CourseName $18. NumberOfHoles Par Yardage GreenFees;
 78         RUN;
 
 ERROR: Library TRAVEL does not exist.
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 79         
 80         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 93         

Hello everyone,

The code was created by SAS 9.2 user,

and I hope to transform it to use in my SAS Studio.

The code and Log was as above.

Is anyone having some suggestions?

 

Thanks very much!:)

10 REPLIES 10
jc3992
Pyrite | Level 9
infile '/foders/myfolders/Golf.dat'; 

sorry the above was what I edited for my SAS Studio.

The original was 

LIBNAME travel "&dirOUT"; 
DATA travel.golf; 
   INFILE "&dirdata.Golf.dat"; 
   INPUT CourseName $18. NumberOfHoles Par Yardage GreenFees; 
RUN;
Reeza
Super User

You never declared a value for libout.

 

%let dirout = /folders/myfolders/;

 


@jc3992 wrote:
infile '/foders/myfolders/Golf.dat'; 

sorry the above was what I edited for my SAS Studio.

The original was 

LIBNAME travel "&dirOUT"; 
DATA travel.golf; 
   INFILE "&dirdata.Golf.dat"; 
   INPUT CourseName $18. NumberOfHoles Par Yardage GreenFees; 
RUN;

 

 

jc3992
Pyrite | Level 9
LIBNAME travel "&dirOUT"; 
%let dirout = /folders/myfolders/; 
data travel.golf; 
INFILE '/folders/myfolders/Golf.dat'; 
input CourseName $18. NumberOfHoles Par Yardage GreenFees; 
RUN;

It's not working though

Several attempts

 

%let dirout = /folders/myfolders/; 
LIBNAME travel "&dirOUT"; 
DATA travel.golf; 
   INFILE "&dirdata.Golf.dat"; 
   INPUT CourseName $18. NumberOfHoles Par Yardage GreenFees; 
RUN; 
LIBNAME travel "&dirOUT"; 
%let dirout = /folders/myfolders/; 
DATA travel.golf; 
   INFILE "&dirdata.Golf.dat"; 
   INPUT CourseName $18. NumberOfHoles Par Yardage GreenFees; 
RUN; 
Reeza
Super User

You can't create it AFTER you try and use it....

 

LIBNAME travel "&dirOUT"; <- using it;
%let dirout = /folders/myfolders/;  <- creating it;

 

Reorder that....

 


@jc3992 wrote:
LIBNAME travel "&dirOUT"; 
%let dirout = /folders/myfolders/; 
data travel.golf; 
INFILE '/folders/myfolders/Golf.dat'; 
input CourseName $18. NumberOfHoles Par Yardage GreenFees; 
RUN;

It's not working though

Several attempts

 

%let dirout = /folders/myfolders/; 
LIBNAME travel "&dirOUT"; 
DATA travel.golf; 
   INFILE "&dirdata.Golf.dat"; 
   INPUT CourseName $18. NumberOfHoles Par Yardage GreenFees; 
RUN; 
LIBNAME travel "&dirOUT"; 
%let dirout = /folders/myfolders/; 
DATA travel.golf; 
   INFILE "&dirdata.Golf.dat"; 
   INPUT CourseName $18. NumberOfHoles Par Yardage GreenFees; 
RUN; 

 

Reeza
Super User

D'oh! @Tom is correct, you're creating DIROUT and using DIRDATA which is likely another issue, unless you intended to have two different macro variables. 

Tom
Super User Tom
Super User

Make sure to define BOTH of your macro variables before using them.

Or easier still get rid of the macro variables and just type the paths directly into the LIBNAME and INFILE statements.

jc3992
Pyrite | Level 9

Like this?

 

libname travel '/folders/myfolders/Golf.dat'; 
data travel.golf; 
infile '/folders/myfolders/Golf.dat'; 
input CourseName $18. NumberOfHoles Par Yardage GreenFees; 
RUN;

The LOG:

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         libname travel '/folders/myfolders/Golf.dat';
 NOTE: Library TRAVEL does not exist.
 74         data travel.golf;
 75         infile '/folders/myfolders/Golf.dat';
 76         input CourseName $18. NumberOfHoles Par Yardage GreenFees;
 77         RUN;
 
 ERROR: Library TRAVEL does not exist.
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 78         
 79         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 92         
Reeza
Super User

In general, libnames are pointers to where your files are stored, not to a specific file.

 

%let dirData = /folders/myfolders/;

libname travel "&dirData.";

data travel.golf;
infile "&dirData.Golf.dat";
input ... ;
run;

 

*Libnames can also be used to connect to an XLSX file, a database such as SQL server or Access DB, or specific file types such as SPSS data sets. 

Kurt_Bremser
Super User

Maxim 1: Read the documentation.

The documentation for the libname statement has a clear pointer to the operating-system specific documentation (so-called SAS Companion) for what constitutes a library. There you will see that a library on a UNIX or Windows system is a directory, not a file.

 

Still better, you should work through the tutorials for SAS UE, as that will clean up most of your problems before they arise, in this case http://video.sas.com/detail/videos/sas-analytics-u/video/4005088074001/accessing-your-existing-data:...

jc3992
Pyrite | Level 9

Will try that.

Thanks!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 2628 views
  • 4 likes
  • 4 in conversation