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!:)
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;
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;
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;
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;
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.
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.
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
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.
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:...
Will try that.
Thanks!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.