SAS University Edition - Reading Files From Hard Drive Problem

Reply
Occasional Contributor
Posts: 13

SAS University Edition - Reading Files From Hard Drive Problem

All,

I have seen this question in different forms but here is the scenario.  I have installed SAS University Edition on an external hard drive and would like for the program to read txt files from either the external hard drive or the hard drive on my computer.  It seems to append a path to the beginning of each file name that I do not understand.  I cannot see any setup file where this would be changed.  Here is the error:

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

42 ;

43 DATA LISTINP;

44 %let path=C:/;

45 infile "path/Pgm1ExtInp.txt";

46 INPUT ID HEIGHT WEIGHT GENDER $ AGE;

47 

48 

ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/path/Pgm1ExtInp.txt.

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

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

WARNING: Data set WORK.LISTINP was not replaced because this step was stopped.

NOTE: DATA statement used (Total process time):

  real time 0.00 seconds

  cpu time 0.00 seconds

The highlighted path I do not find.  I have also tried to put it on the same directory as the program and used:

infile "E:\SAS University Edition Download\SASUniversityEdition\myfolders\sasuser.v94\Pgm1ExtInp.txt"

but again it appends the highlighted path to the front.

How can I disable or change that default so that I can read that file as input?

All help is appreciated.  Thanks.

Craig

SAS Super FREQ
Posts: 8,743

Re: SAS University Edition - Reading Files From Hard Drive Problem

Hi:

  Please read this previous forum posting:

https://communities.sas.com/message/223452#223452

  The bottom line is that you are getting this message:

ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/path/Pgm1ExtInp.txt.

because your version of SAS University Edition is looking for the file *INSIDE* the virtual machine. that location in pink above is the "inside the VM" default path. So SAS is appending your INFILE location with the "inside" location. You used an INCORRECT infile statement and so, SAS had no choice but to look *INSIDE* the VM for the file.

  Here are your mistakes:

1) you specified &path incorrectly (you had %let path=c:/) but, the SAS University Edition does not "directly" read from your C drive or your E drive

2) you omitted an & from the reference in your INFILE statement -- even IF you had specified the path correctly (such as %let path=/folders/myfolders/somedata), in your infile statement, you omitted the leading &. So you had this:

DATA LISTINP;  <--- usually, this comes AFTER the %LET statement

%let path=C:/;  <--- this is wrong because SAS UE won't read from your C: drive

infile "path/Pgm1ExtInp.txt";  <-- this is wrong because you left off the & on path

and you should have had something like this:

%let path=/folders/myfolders/somedata;

DATA LISTINP;

infile "&path/Pgm1ExtInp.txt";   <--- notice the &path

3) it probably means you didn't set up shared folders or shortcuts as described in the link above. The above previous forum posting explains how SAS University Edition does not talk directly to your computer. You use your virtualization software - -either Virtual Box or VM Ware -- to set up "shared folders" or shortcut locations. Then, you refer to those with the naming convention described in many, many places on the forum and in the documentation for the Quick Start Guide.

  For example, one of the very last steps in the setup instructions is for you to set up shared folders. So, for example, if you have this directory on your C: drive:

C:\SASUniversityEdition then you are instructed to make a "sub-folder" called myfolders under that location:

C:\SASUniversityEdition\myfolders

  And THEN, you are not done yet. THEN, you need to define that location to your VirtualBox or VMware player as a "shared folder" location. Once you do that, you can put files in that location and you can make subfolders under that location. So now, let's assume that you have made a subfolder called "somedata" -- and you have put a file called Pgm1ExtInp.txt in that location. So this is what you see in Windows Explorer:

C:\SASUniversityEdition\myfolders\somedata\Pgm1ExtInp.txt

however, in the SAS Studio interface to SAS University Edition you would NOT code this C:\ drive location. instead, you would code:

/folders/myfolders/somedata/Pgm1ExtInp.txt

The color coding in the 2 path names above is meant to show you how each piece of the physical name, as seen on Windows (if you put the file in your shared folder location) will correspond to how you specify the path for SAS University Edition.

  So then if you have a %LET statement to set up a macro variable, so you do not have to keep typing the whole long path, then your code would be something like this:

%let path=/folders/myfolders/somedata;

DATA LISTINP;

infile "&path/Pgm1ExtInp.txt";   

or

alternately, you could code the full University Edition path in the INFILE statement:

infile "/folders/myfolders/somedata/Pgm1ExtInp.txt"; 

  As you can see from the screenshots that have been posted above and on some of these other forum postings, when you get the path right for your shared folders or shortcuts, SAS can read the data files.

cynthia

Here are some other useful forum postings:

INFILE statement for PRG1 on Univ Edition:

  https://communities.sas.com/message/222742#222742 (example country.dat)

  https://communities.sas.com/message/224467#224467 (example country.dat)

  https://communities.sas.com/message/223452#223452 (infile in general)

  

Reading Excel files on Univ Edition:

  https://communities.sas.com/message/217721#217721 (example custfm.xls)

  https://communities.sas.com/message/215248#215248

  https://communities.sas.com/message/218581#218581

    

LIBNAME statement on Univ Edition:

  https://communities.sas.com/message/216397#216397

  https://communities.sas.com/message/216696#216696

  https://communities.sas.com/message/226407#226407

Occasional Contributor
Posts: 8

Re: SAS University Edition - Reading Files From Hard Drive Problem

Hi Cynthia,

I just installed SAS University edition, followed instruction on how to set up shared folder.The VM has it set as

K:\SASUniversityEdition\myfolders (I show it in attached file).

 

I following your path 1 on setting  an infile statement according to your recomendations, and  here is very simple code I am running:

 

data veg;
Infile "folders/myfolders/veggies.txt";
input Name $ Code $ Days Number Price;
CostPerSeed = Price / Number;
run;

 

Still I am getting this  error:

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56 title "SAS Prog to read veggies data";
57 data veg;
58 Infile "folders/myfolders/veggies.txt";
59 input Name $ Code $ Days Number Price;
60 CostPerSeed = Price / Number;
61 run;
 
ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/folders/myfolders/veggies.txt.
 
Does myfolder has to be on C: drive only? Appreciate your answer.
 

 


20160220_Shared_folder_setting.png
SAS Super FREQ
Posts: 8,743

Re: SAS University Edition - Reading Files From Hard Drive Problem

Hi:

  Please reread my original posting carefully. My examples all show /folders/myfolders (with a / in front of folders) and your example does not show a leading slash at the beginning of the path. The beginning slash is required.

cynthia

New Contributor
Posts: 4

Re: SAS University Edition - Reading Files From Hard Drive Problem

For the SAS university edition virtual application  , it thinks you are on a unix machine .

-> create 'myfolders' as per the install document.

-> got to Server files and folders . under your folder there will be a ser folder .. something like 'sasuser.v94'

-> right click on 'sasuser.v94' and select upload files .

-> upload all the files , and you will see the files under the user folder.

 

you can useinfile stement like this in your code

 => infile "/folders/myfolders/sasuser.v94/mydata.txt";

Ask a Question
Discussion stats
  • 4 replies
  • 3634 views
  • 0 likes
  • 4 in conversation