Hi guys, when I submit the code below, the log says:
NOTE: The variable ReadIt exists on an input data set, but was also specified in an I/O
statement option. The variable will not be included on any output data set.
ERROR: Physical file does not exist, C:\Users\l_jingn\route1.dat.
ReadIt=route1.dat lastfile=0 RouteID= Origin= Dest= Distance=. Farelst=. FareBusiness=.
FareEcon=. FareCargo=. output=. _ERROR_=1 _N_=1
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 1 observations read from the data set SASUSER.RAWDATA.
WARNING: The data set WORK.NEWROUTE may be incomplete. When this step was stopped there were
0 observations and 9 variables.
WARNING: Data set WORK.NEWROUTE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
CODE:
filename in ('C:\Users\l_jingn\Documents\My SAS Files(32)\9.3\route1.dat'
'C:\Users\l_jingn\Documents\My SAS Files(32)\9.3\route2.dat'
'C:\Users\l_jingn\Documents\My SAS Files(32)\9.3\route3.dat'
'C:\Users\l_jingn\Documents\My SAS Files(32)\9.3\route8.dat'
'C:\Users\l_jingn\Documents\My SAS Files(32)\9.3\route9.dat'
'C:\Users\l_jingn\Documents\My SAS Files(32)\9.3\route10.dat');
data work.newroute;
set sasuser.rawdata;
infile in filevar=readit end=lastfile;
do while(lastfile=0);
input @1 RouteID $7. @8 Origin $3. @11 Dest $3.
@14 Distance 5. @19 Farelst 4.
@23 FareBusiness 4. @27 FareEcon 4.
@31 FareCargo 5.
output;
end;
run;
QUESTION:
I've already specified the physical place of my raw data , why log continues saying that "Physical file does not exist, C:\Users\l_jingn\route1.dat."?
How can I let the code find where my raw data is?
l_jingn / chouchou,
The message is telling your that: 'C:\Users\l_jingn\Documents\My SAS Files(32)\9.3\route1.dat' does not exist check for a typo ....
what happens next is that it will check 'route1.dat' does exist in the current directory ( initial directory the . ) in your case 'C:\Users\l_jingn'.
The dataset is still not existing there, so the error with that name is given.
As this is run-time error processing stops.
More easy to get all files in a directory is using wildcarding:
for example a dir listing showing the first 10 records.
filename ikke '/folders/myfolders' ;
data _null ;
length filename filenmcr $250 ;
retain _nfl 1 eovfl 1 ;
infile ikke(*.sas) filename=filenmcr eov=eovfl eof=tailer end=endfl ;
input; _nfl=_nfl+1;
if ( eovfl ) then link header; eovfl=0;
if (_nfl <10) then do;
put _nfl _infile_ ;
end;
return;
header:
filename=filenmcr;
put "--- f"filenam" --"e ; _nfl=1 ;
return;
tailer:
put "total records" _nfl / ;
return;
run;
What type of SAS installation do you have? If it's not local but on a server, that server can't see data on your local C drive.
Yes, I suspect he is using the UE edition. Have a look at:
Not the UE editon as the it is BI/DI server approach running Unix. The error message would give Unix namings.
Not a BI/DI server running as the default directory is wrong according that note. It is set to a configuration directory not the user home.
Indeed that note is showing the cause as described. When a file is not found it will try the current directory.
If you do not a give a path it is the current directory.
As the error message is a windows-related one (C:\...) as the current directory and the intention was to read form that one I am assuming it is a local SAS installation.
The only other way to get this is using a remote connection (Connect/Eguide) where at the Windows server side the user has been defined but the user has placed the data on the desktop.
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.
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.