Learning SAS? Welcome to the exclusive online community for all SAS learners.

I am not able to open this file(window 7)

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

I am not able to open this file(window 7)

sas problem.png

I am trying to open this file but it keeps showing same error message.

Could you explain how to fix this problem? I just started to learn how to use SAS.

Thank you


Accepted Solutions
Solution
‎08-01-2014 07:54 PM
SAS Super FREQ
Posts: 8,743

Re: I am not able to open this file(window 7)

Hi:

  Jaap is correct. And, to further clarify, you should not attempt a "relative" file location in your INFILE statement. When you use a relative name -- or just filename.ext, SAS inside the Virtual Machine is going to look for the file *inside* the Virtual Machine, which is why it "prepends" the Unix location "/opt/sasinside/SASConfig/Lev1/SASApp" path to your simple filename reference of country.dat.
     

  Since you have the program files from one of our courses in your Folders location, then I assume that you have put ALL the files in that location and that country.dat is located in the same folder that you show in your screen shot.

Let's assume that you have made this directory on your computer: C:\SASUniversityEdition\myfolders\prg1 and that the location of the data file is:

        

C:\SASUniversityEdition\myfolders\prg1\country.dat -- That location is NOT inside your Virtual Machine. But you must have specified this or another location as your shared folder location. So IF your files were in the location I show, then your correct INFILE statement would be:

INFILE '/folders/myfolders/prg1/country.dat' dlm='!';

        

But, if your local (host) machine folder was:

C:\SASUniversityEdition\myfolders\wombat\country.dat

then your INFILE statement would be:

INFILE '/folders/myfolders/wombat/country.dat' dlm='!';

When you are using SAS on a remote server (whether with Enterprise Guide to a remote server or from SAS Studio to SAS in your Virtual Machine), a best practice is to use a fully qualified path name when you reference "external" files on disk.

And when I teach the Programming 1 class and we use the program P102e01.sas, the code has this INFILE statement. So I wonder whether you changed something in your code or whether you have code from an older version of the course. In newer versions of the code for Programming 1, we use a macro variable, &PATH to be a placeholder for the physical location of the data. In my file, the INFILE statement looks like this:

   infile "&path\country.dat" dlm='!';

But for that to work, in your LIBNAME.SAS program for the course, you should have a %LET statement that contains code like this:

%let path=/folders/myfolders/prg1;

and then the only other thing you would have to do is "flip the slash" from a Windows back slash to a Unix forward slash:

   infile "&path/country.dat" dlm='!';

  But if you do not use a macro variable such as &path to represent the high level path reference, then you must hard-code it in every program where you need an INFILE statement.

  If you don't like the idea of a macro variable for the path, then you MUST use a fully qualified Unix path that points to your shared directory folder where the data file resides.

cynthia

View solution in original post


All Replies
Valued Guide
Posts: 3,208

Re: I am not able to open this file(window 7)

Check all the notes for UE is running under Linux in a Virtual machine not your own Windows.

You are getting Linux error messages.   Change naming conventions accordingly

---->-- ja karman --<-----
Solution
‎08-01-2014 07:54 PM
SAS Super FREQ
Posts: 8,743

Re: I am not able to open this file(window 7)

Hi:

  Jaap is correct. And, to further clarify, you should not attempt a "relative" file location in your INFILE statement. When you use a relative name -- or just filename.ext, SAS inside the Virtual Machine is going to look for the file *inside* the Virtual Machine, which is why it "prepends" the Unix location "/opt/sasinside/SASConfig/Lev1/SASApp" path to your simple filename reference of country.dat.
     

  Since you have the program files from one of our courses in your Folders location, then I assume that you have put ALL the files in that location and that country.dat is located in the same folder that you show in your screen shot.

Let's assume that you have made this directory on your computer: C:\SASUniversityEdition\myfolders\prg1 and that the location of the data file is:

        

C:\SASUniversityEdition\myfolders\prg1\country.dat -- That location is NOT inside your Virtual Machine. But you must have specified this or another location as your shared folder location. So IF your files were in the location I show, then your correct INFILE statement would be:

INFILE '/folders/myfolders/prg1/country.dat' dlm='!';

        

But, if your local (host) machine folder was:

C:\SASUniversityEdition\myfolders\wombat\country.dat

then your INFILE statement would be:

INFILE '/folders/myfolders/wombat/country.dat' dlm='!';

When you are using SAS on a remote server (whether with Enterprise Guide to a remote server or from SAS Studio to SAS in your Virtual Machine), a best practice is to use a fully qualified path name when you reference "external" files on disk.

And when I teach the Programming 1 class and we use the program P102e01.sas, the code has this INFILE statement. So I wonder whether you changed something in your code or whether you have code from an older version of the course. In newer versions of the code for Programming 1, we use a macro variable, &PATH to be a placeholder for the physical location of the data. In my file, the INFILE statement looks like this:

   infile "&path\country.dat" dlm='!';

But for that to work, in your LIBNAME.SAS program for the course, you should have a %LET statement that contains code like this:

%let path=/folders/myfolders/prg1;

and then the only other thing you would have to do is "flip the slash" from a Windows back slash to a Unix forward slash:

   infile "&path/country.dat" dlm='!';

  But if you do not use a macro variable such as &path to represent the high level path reference, then you must hard-code it in every program where you need an INFILE statement.

  If you don't like the idea of a macro variable for the path, then you MUST use a fully qualified Unix path that points to your shared directory folder where the data file resides.

cynthia

Occasional Contributor pjg
Occasional Contributor
Posts: 5

Re: I am not able to open this file(window 7)

Hi,

This mostly makes sense. But still a little unclear on the pathnames and the exact change i need to make. This is really my first SAS program. I am running SAS as a virtual machine on my Windows laptop. Here is the error message I am receiving:

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

42 ;

43 data shipping1;

44 infile "c:\SASdata\shipping_file.txt" dlm=',';

45 input cusno cusnam $ order_no inv_no item $ title $

46 inv_qty sls_amt shp_type $ shpvia $ trackno invdte cuslin $;

47 run;

ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/c:\SASdata\shipping_file.txt.

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.SHIPPING1 may be incomplete. When this step was stopped there were 0 observations and 13 variables.

NOTE: DATA statement used (Total process time):

real time 0.03 seconds

cpu time 0.04 seconds

48

49 ;

50 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

60 ;

So just need to know what the infile statement should be to reference the text file correctly.

Thanks very much.

SAS Super FREQ
Posts: 8,743

Re: I am not able to open this file(window 7)

Hi:

   The instructions for the SAS University Edition explain that you need to make a folder on your C: drive called c:\SASUniversityEdition and then you were supposed to make  a subfolder UNDER that directory called myfolders. When you put data into that location, assuming that you have shared that location, then you can make subdirectories under the myfolders directory. All the directories UNDER that location will be "shared" too.

So, for example these files would have these INFILE statements:

c:\SASUniversityEdition\myfolders\wombat\myfile.txt  INFILE "/folders/myfolders/wombat/myfile.txt";

c:\SASUniversityEdition\myfolders\SASdata\myfile2.txt INFILE "/folders/myfolders/SASdata/myfile2.txt";

c:\SASUniversityEdition\myfolders\other\myfile3.txt  INFILE "/folders/myfolders/other/myfile3.txt";

  Sadly, your current INFILE statement does not look like you put your data file in your shared folder.  SAS University Edition CANNOT read any data with a C: drive location. So your INFILE statement will NOT work.

  Did you set up shared folders as you were instructed to do? C:\SASdata does not seem to conform to the requirement that you put your data into your shared folder.  This link describes a shared folder: What is a shared folder?

  When you configure your virtualization software, there is a screen in every application (Virtual Box or VM Ware player) where you share the folder. Without seeing exactly how you turned this on, it is nearly impossible for anyone to help you with your INFILE statement.

  One thing you might try is to work with Tech Support on this. They can help you figure out whether you have successfully defined shared folders. My suggestion would for you to take a step back. Stop trying to run code and reread the instructions for setting up shared folders. Then, make sure you have done it correctly. Next, once you have correctly defined a shared folder location, and assuming you move your SASdata files under your shared folder location, then the INFILE statement should be fairly easy to figure out from all the information in this post.

 

   I am sorry I couldn't just give you an INFILE statement that would work. The INFILE statement really depends on the folder structure you've set up and how the C:\ drive structure corresponds to the Unix location that the SAS University Edition needs to have.

cynthia

Occasional Contributor pjg
Occasional Contributor
Posts: 5

Re: I am not able to open this file(window 7)

Cynthia,

Thank you for your response. I was able to figure out the problem, based on your previous replies on this topic, and making changes to the path of the .txt file. Great to get over this initial hurdle. Now I can really get busy.

Thanks again.

Occasional Contributor
Posts: 8

Re: I am not able to open this file(window 7)

Cynthia,

I am new to SAS and writing a very simple program and getting the following error message: 'ERROR: Physical file does not exist,/opt/sasinside/SASConfig/Lev1/SASApp/C:\jaybackup\sas\sasuniversityedition\myfolders\myinputdata\President.dat.'. I have the Shared defined as: 'c:\jaybackup\sas\sasuniversityedition\myfolder'. When I am logging into the SAS Studio, I am NOT getting the Warning message about myfolder directory missing. Any Ideas.

Any ideas would be appreciated.

jay

Super User
Posts: 10,500

Re: I am not able to open this file(window 7)

1) better to start with new thread

2) Use the forum search tool for similar threads. This issue has been covered about once per week since the University Edition was released.

Basically you have incorrectly defined the folder in relation to where SAS resides. NOTE that you have a mixture of UNIX (////) file path elements and windows (\\\) so that the system is looking for the windows disk to be mounted subordinate to the Unix.

Occasional Contributor
Posts: 8

Re: I am not able to open this file(window 7)

Apparently you are mixing up what the error message is saying and what the real issue is. The INFILE statement is defined as: INFILE 'C:\jaybackup\sas\sasuniversityedition\myfolders\myinputdata\President.dat', and the shared folder is defined at: 'C:\jaybackup\sas\sasuniversityedition\myfolders' and has absolutely nothing to do where SAS is running from.  SAS is running from a standalone PC and not a Unix box.

Valued Guide
Posts: 3,208

Re: I am not able to open this file(window 7)

Jayredwine follow Cyntia's advices. Please understand the concept of virtual machine. SAS UE is running in a Virtual machine using a Linux version (Centos). May be confusing but that is a result of VM's.

---->-- ja karman --<-----
Occasional Contributor
Posts: 8

Re: I am not able to open this file(window 7)

Ignore previous, I figured it out.....

Thanks for the input------jay

Valued Guide
Posts: 3,208

Re: I am not able to open this file(window 7)

Cynthia that is one rare occasions I am seeing you becoming impatient.  We are of an older generation educated do try to find/research first before asking for an direct answer. For learning at higher levels that attitude is still important.   On the other hand......

The UE is a very good initiative. Still there are things that can be improved.  A lot of newbies will come in and they are confronted with a lot of weird approaches. Using SAS studio UE is bringing you also:

- into the Client-Server approach with a Server running Linux for your sas processing.

  Even when they are installing that local on their own machine. 

- A virtual machine with some predefined connections (having limitations).   
That are a lot other technical areas to learn aside learning sas en learning statistics-programming.

In my opinion it would be more clear to have a real client-server approach allowing more of normal usage with sftp/ssh using the generic sasdemo account and use that sasdemo account at Linux according common Unix usage. Than the home-directory of sasdemo could be seen as a "my documents and settings" that is always working.

Not the weird location of the current directory that is left behind by some scripting. 50345 - Changing the current working directory for the SAS® Workspace Server         

---->-- ja karman --<-----
SAS Super FREQ
Posts: 8,743

Re: I am not able to open this file(window 7)

Jaap:

  I am sorry that my post came across as "impatient". I was trying to be thorough. The big font and color coding were meant to only convey  and show the relationship between the Windows file path and the path that needs to be used with the University Edition -- it was not meant to convey impatience. I apologize to anyone who thought I was being impatient.

  Since I teach Programming 1, I recognized some of the files being used and so, I knew that not only did the /folders/myfolders location needed to be explained, in relation to using country.dat;  but the issue of using a relative path also needed to be explained or else none of the INFILE statements in the class programs would work. When we revised Programming 1 (before the introduction of the University Edition), we introduced the use of &PATH in the program code. But anyone who has those files from our classes will need to change Windows slashes to Unix slashes.

  I will endeavor for my posts to not sound "impatient" in the future.

cynthia

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 12 replies
  • 3212 views
  • 6 likes
  • 6 in conversation