BookmarkSubscribeRSS Feed
chouchou
Calcite | Level 5

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?

4 REPLIES 4
jakarman
Barite | Level 11

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;

---->-- ja karman --<-----
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Yes, I suspect he is using the UE edition.  Have a look at:

http://support.sas.com/kb/53/333.html

jakarman
Barite | Level 11

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. 

---->-- ja karman --<-----

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 615 views
  • 0 likes
  • 4 in conversation