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

What code should I use to access data already in SAS folder?

Reply
Occasional Contributor
Posts: 7

What code should I use to access data already in SAS folder?

Hello,

I need help in writing the initial code to access data in my folder.  Everything I've tried hasn't worked.  I've tried proc import, infile, reffile, and libname but the results doesn't show any data.  When I click on the file in myfolders section all of the data appears.  I know it has something to do with how I'm coding. Help!

Contributor
Posts: 39

Re: What code should I use to access data already in SAS folder?

What is the data? Excel workbooks, CSV files?

Occasional Contributor
Posts: 7

Re: What code should I use to access data already in SAS folder?

Its a sas7bdat file

Contributor
Posts: 39

Re: What code should I use to access data already in SAS folder?

What are you trying to do? 

 

To just display the data, 

 

    libname x '[path to the file]';

 

    proc sql;

    select * from x.data;

 

 

Occasional Contributor
Posts: 7

Re: What code should I use to access data already in SAS folder?

Thanks for your response. I have a whole list of things I'm trying to do but I can't seem to get started.  First, I need to create a box plot of the mean birthweight, ttest, and other descriptive statistics to get started.  Also, odds ratio and regression analysis.  I'm very new to SAS.  This is what I wrote:

 

libname epidata '/folders/myshortcuts/myfolders-2/DataProject2016.sas7bdat';
proc sql;
select*from epidata;
run;

 

This is the error I obtained:

Library epidata does not exist.

(but it's there in the library)

Contributor
Posts: 39

Re: What code should I use to access data already in SAS folder?

Think of the libname as the folder, not the whole pathname to the file.  So try this

 

libname epidata '/folders/myshortcuts/myfolders-2';
proc sql;
select*from epidata.dataProject2016;

Occasional Contributor
Posts: 7

Re: What code should I use to access data already in SAS folder?

It didn't work.  After awhile it stated that the path was thrown?  Not sure what that meant.

Contributor
Posts: 39

Re: What code should I use to access data already in SAS folder?

Should there be a drive letter in front of the library' s path?  What system are you on?

Occasional Contributor
Posts: 7

Re: What code should I use to access data already in SAS folder?

Yes I'm working on a PC with windows system.  The actual location is in the C drive.

Contributor
Posts: 39

Re: What code should I use to access data already in SAS folder?

Try this:

 

libname epi 'c:/folders/myshortcuts/myfolders-2';
proc sql;
select * from epi.dataProject2016;

 

Notice that I've truncated the library name to "epi."

Occasional Contributor
Posts: 7

Re: What code should I use to access data already in SAS folder?

no luck!

Contributor
Posts: 39

Re: What code should I use to access data already in SAS folder?

Can you post the log output?

Occasional Contributor
Posts: 7

Re: What code should I use to access data already in SAS folder?

 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56
57 libname epi 'c:/folders/myshortcuts/myfolders-2';
NOTE: Library EPI does not exist.
58 proc sql;
59 select * from epi.dataProject2016;
ERROR: File EPI.DATAPROJECT2016.DATA does not exist.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
60
61 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK
Super User
Posts: 17,840

Re: What code should I use to access data already in SAS folder?

Did you place the files in the myfolders that you created? It should be named exactly myfolders, in lowercase and no 2. 

Did you set up the shared drive on your VM?

 

Or did you map a different directory and set that up as a shared drive?

 

You may want to try the SAS Pprogram in 1 e-course which is free online. 

Super User
Posts: 10,500

Re: What code should I use to access data already in SAS folder?

Are you using the SAS University Edition? If so the virtual machine that SAS runs in only sees the files set up for the virtual machine starting at /folders/myfolders AND uses LINUX/UNIX file syntax which is case sensitive and uses / instead of \.

 

If you are using SAS University Edition there are many posts on this forum about this issue.

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