BookmarkSubscribeRSS Feed
epidoctor
Calcite | Level 5

Hi

I'm using SAS University Edition on my MacBook with Virtual Box software. I have two question:

1. How do I point SAS to a folder other than the WORK folder when I'm creating a new dataset ? It automatically goes to WORK and I can't seem to create another path.

 

2. I  downloaded the 2017 dataset from the following website: 

https://www1.nyc.gov/site/doh/data/data-sets/community-health-survey-public-use-data.page 

and I was able to view the dataset in SAS studio.  I then attempted the infile statement 

data chs2017;
infile"C:\iclouddrive\desktop\sasuniversityedition\myfolders\sasuser.v94";

But I am getting an error message :

ERROR: Physical file does not exist,
/opt/sasinside/SASConfig/Lev1/SASApp/C:\iclouddrive\desktop\sasuniversityedition\myfolders\sasuser.v94.
 

Any suggestions on how to resolve this?  These instructions were provided in their codebook but it did not work for me. 

/*enter in the pathway where dataset and format programs are stored*/

libname intdat    'x';
filename formatin 'x\formatstatements_chs2017_public.sas';
%include          'x\formats_chs2017_public.sas';

data chs2017; 
	set intdat.chs2017_public;
run;
proc sort data=chs2017;
	by strata;
run;
proc contents data=chs2017; run; 

 Thanks for your help 

5 REPLIES 5
ballardw
Super User

@epidoctor wrote:

Hi

I'm using SAS University Edition on my MacBook with Virtual Box software. I have two question:

1. How do I point SAS to a folder other than the WORK folder when I'm creating a new dataset ? It automatically goes to WORK and I can't seem to create another path.

 

2. I  downloaded the 2017 dataset from the following website: 

https://www1.nyc.gov/site/doh/data/data-sets/community-health-survey-public-use-data.page 

and I was able to view the dataset in SAS studio.  I then attempted the infile statement 

data chs2017;
infile"C:\iclouddrive\desktop\sasuniversityedition\myfolders\sasuser.v94";

But I am getting an error message :

ERROR: Physical file does not exist,
/opt/sasinside/SASConfig/Lev1/SASApp/C:\iclouddrive\desktop\sasuniversityedition\myfolders\sasuser.v94.
 

Any suggestions on how to resolve this?  These instructions were provided in their codebook but it did not work for me. 

/*enter in the pathway where dataset and format programs are stored*/

libname intdat    'x';
filename formatin 'x\formatstatements_chs2017_public.sas';
%include          'x\formats_chs2017_public.sas';

data chs2017; 
	set intdat.chs2017_public;
run;
proc sort data=chs2017;
	by strata;
run;
proc contents data=chs2017; run; 

 Thanks for your help 


Both of your questions are related. The University Edition runs in a virtual machine that only sees what the Linux virtual machine sees which is set up when you install the VM. For the UE to see any file it should be in a folder or directory subordinate to the /folders/myfolders location. To create a permanent library, which what you mean by other than Work, then create another folder subordinate to the myfolders and issue a libname statement that uses that location

 

libname mylib '/folders/myfolders/projectfolder'; for example

 

The file used in any filename or infile statement also needs to be somewhere in relation to the folders/myfolders.and is referenced with that as the start of the path, not the drive

 

infile "/folders/myfolders/sometextfile.txt" ;

or

filename myfile "/folders/myfolders/sometextfile.txt" ; 

 

If the file is a SAS data set then do not use INFILE. Create a library and use with the libname.datasetname syntax.

epidoctor
Calcite | Level 5

Thanks, for that clear and helpful explanation.

Tom
Super User Tom
Super User

SAS UE is running on UNIX.  So you need to follow UNIX rules for filenames.  Since the filename you used didn't start with the root node, / , it is interpreted as being relative to the current directory.  So the error message is saying there is not filename like what you typed in that directory.

 

SAS UE is running on a VIRTUAL machine. Not on your real machine. So it cannot see the files on your real machine. It can only see the folders that you shared with it when you setup the virtual machine.  And that folder must be reference using the name that it has in the virtual machine.

 

NYC Community Health Services has posted SAS datasets. So there is not need to "import" them. Just use them.  Put the file into a folder and point a libref at that folder.  Let's assume you made a folder named CHS (note that case is important because UNIX filesystems are case sensitive) in the folder or your real machine that you shared with SAS UE.  And you downloaded the 2017 publich use dataset from the website there. Then your program might look like:

 

libname chs '/folders/myfolders/CHS/';

proc contents data=chs.chs2017_public ;
run;

 

Kurt_Bremser
Super User

You say you use a MacBook. Why do you think that a Windows path like

C:\iclouddrive\desktop\sasuniversityedition\myfolders\sasuser.v94

can work at all? MacOs is also a UNIX flavor and does neither have those silly drive letters nor backslashes in filenames.

Maxim 15: Know Your Playing Field. This is true both for the host operating system and the Linux contained in the UE virtual machine. The extensive tutorials supplied for University Edition cover this, so you should work through them.

 

Reeza
Super User

The code they provided is correct, but you need to replace X with the path to the folder correctly, the folder being where you placed the file you downloaded. Assuming you put the files you downloaded, both dataset and programs, in the myfolders location the code would like as follows. 

 

You should have set up myfolders in the initial instruction. 

 

 

/*enter in the pathway where dataset and format programs are stored*/

libname intdat    '/folders/myfolders/';
filename formatin '/folders/myfolders/formatstatements_chs2017_public.sas';
%include          '/folders/myfolders/formats_chs2017_public.sas';

data chs2017; 
	set intdat.chs2017_public;
run;
proc sort data=chs2017;
	by strata;
run;
proc contents data=chs2017; run; 

@epidoctor wrote:

Hi

I'm using SAS University Edition on my MacBook with Virtual Box software. I have two question:

1. How do I point SAS to a folder other than the WORK folder when I'm creating a new dataset ? It automatically goes to WORK and I can't seem to create another path.

 

2. I  downloaded the 2017 dataset from the following website: 

https://www1.nyc.gov/site/doh/data/data-sets/community-health-survey-public-use-data.page 

and I was able to view the dataset in SAS studio.  I then attempted the infile statement 

data chs2017;
infile"C:\iclouddrive\desktop\sasuniversityedition\myfolders\sasuser.v94";

But I am getting an error message :

ERROR: Physical file does not exist,
/opt/sasinside/SASConfig/Lev1/SASApp/C:\iclouddrive\desktop\sasuniversityedition\myfolders\sasuser.v94.
 

Any suggestions on how to resolve this?  These instructions were provided in their codebook but it did not work for me. 

/*enter in the pathway where dataset and format programs are stored*/

libname intdat    'x';
filename formatin 'x\formatstatements_chs2017_public.sas';
%include          'x\formats_chs2017_public.sas';

data chs2017; 
	set intdat.chs2017_public;
run;
proc sort data=chs2017;
	by strata;
run;
proc contents data=chs2017; run; 

 Thanks for your help 


 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 2096 views
  • 0 likes
  • 5 in conversation