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

how to specify path to uploaded file to import

Accepted Solution Solved
Reply
Contributor
Posts: 26
Accepted Solution

how to specify path to uploaded file to import

What the heck is wrong here and why won't this work?  I'm trying to follow advice from this forum to import an excel file that I have uploaded to a folder.. it keeps adding two dashes before the filename??

PROC IMPORT

  OUT= WORK.rawdata

  DATAFILE= "/folders/myfolders/RILpop2013phenotypes/rawdatav2-new-line-names-checks-forSAS-code-segs.xlsx"

    DBMS=xlsx REPLACE;

    SHEET="forsas";

    GETNAMES=YES;

RUN;

Then the log says:

ERROR: Physical file does not exist, /folders/myfolders/RILpop2013phenotypes//rawdatav2-new-line-names-checks-forSAS-code-segs.xlsx.

Attached is my folder structure...

Screen Shot 2015-03-09 at 14.03.34.png


Accepted Solutions
Solution
‎03-09-2015 09:10 PM
SAS Employee
Posts: 146

Re: how to specify path to uploaded file to import

Sorry this is so frustrating.  The answers you are seeing were assuming you were using the SAS University Edition - which is a download you run locally.  It uses the shared folders concept to map to data on your local machine using the myfolders naming convention.  You are using SAS OnDemand for Academics - the interface, SAS Studio, is the same but SAS is running on a server in NC (or "on the cloud" if you're into that terminology).  You don't have the same shared folders concept since you can't map to your local drives or data.  You've already figured out how to upload your data, so all you're missing is how to reference it in your code.

The easiest way for me - and this is nice since it works no matter how you're running SAS - is in the folders area of the left navigation of SAS Studio, click on the folder that contains your file then right click and select properties.  In the dialog that comes up, it tells you the filepath that you can copy (or Ctrl C) then paste into your code.  Looking at your screen shot, I'm betting the property of that folder is something like:

/home/your-user-name/RILpop2013phenotypes

So that means your DATAFILE= option should be something like "/home/your-user-name/RILpop2013phenotypes/rawdatav2-new-line-names-checks-forSAS-code-segs.xlsx"

There are some resources on the support site at SAS OnDemand for Academics that also might help.  Let us know if that's not it..

View solution in original post


All Replies
Super User
Posts: 17,784

Re: how to specify path to uploaded file to import

Do you have the latest version of SAS UE?  I don't have any issues with the code above.

Also, check that the case sensitivity of the file path and name match exactly.

You can also contact SASAnalyticsU@SAS.com for personal help.

Contributor
Posts: 26

Re: how to specify path to uploaded file to import

I'm using the SAS on demand web thingy.. so I don't know anything about versions.. this is what it says in the "about SAS"

Release: 3.2 (Enterprise Edition)

Supported browsers:

  • Microsoft Internet Explorer 9, 10, 11
  • Mozilla Firefox 21+
  • Google Chrome 27+
  • Apple Safari 6.0+ (on Apple OS X)

Build date: Monday, January 12, 2015, 9:44 AM
SAS Mid-tier release: Monday, January 12, 2015, 9:24 AM
SAS release: 9.04.01M2P07232014
SAS platform: Linux LIN X64 2.6.32-504.8.1.el6.x86_64
Site name: SAS ONDEMAND FOR ACADEMICS
Site number: 70094220

Copyright © 2012-2014, SAS Institute Inc., Cary, NC, USA.

Super User
Posts: 10,483

Re: how to specify path to uploaded file to import

// appearing in the error message doesn't quite match the code submitted

Super User
Posts: 17,784

Re: how to specify path to uploaded file to import

I think that's what the OP meant about adding 'two dashes'.

I've seen it happen with text files, but usually the import works so I haven't really cared.

Super User
Posts: 3,102

Re: how to specify path to uploaded file to import

I have noticed the extra slashes SAS Studio puts in the SAS log for back slashes but the code still works. My SAS Studio and SAS server run under Windows so I need to use back slashes anyway for directory references.

Try this test:

%let testvar = test \ test;

%put &testvar;

In the SAS log this changes to test \\ test in my SAS Studio V 3.2. Forward slashes don't appear to be repeated but it might be different for file references.


Contributor
Posts: 26

Re: how to specify path to uploaded file to import

Well, if the double dashes isn't the issue.. why can't I import the file?  This is really frustrating.. seems like importing an excel file should be very easy..

I have checked the filename and path a million times..

Super User
Super User
Posts: 6,499

Re: how to specify path to uploaded file to import

To check if you have typed the path properly try using it to write a file.

PROC exPORT

  data = sashelp.class

  outFILE= "/folders/myfolders/RILpop2013phenotypes/sashelp_class.xlsx"

    DBMS=xlsx REPLACE;

RUN;

Solution
‎03-09-2015 09:10 PM
SAS Employee
Posts: 146

Re: how to specify path to uploaded file to import

Sorry this is so frustrating.  The answers you are seeing were assuming you were using the SAS University Edition - which is a download you run locally.  It uses the shared folders concept to map to data on your local machine using the myfolders naming convention.  You are using SAS OnDemand for Academics - the interface, SAS Studio, is the same but SAS is running on a server in NC (or "on the cloud" if you're into that terminology).  You don't have the same shared folders concept since you can't map to your local drives or data.  You've already figured out how to upload your data, so all you're missing is how to reference it in your code.

The easiest way for me - and this is nice since it works no matter how you're running SAS - is in the folders area of the left navigation of SAS Studio, click on the folder that contains your file then right click and select properties.  In the dialog that comes up, it tells you the filepath that you can copy (or Ctrl C) then paste into your code.  Looking at your screen shot, I'm betting the property of that folder is something like:

/home/your-user-name/RILpop2013phenotypes

So that means your DATAFILE= option should be something like "/home/your-user-name/RILpop2013phenotypes/rawdatav2-new-line-names-checks-forSAS-code-segs.xlsx"

There are some resources on the support site at SAS OnDemand for Academics that also might help.  Let us know if that's not it..

Contributor
Posts: 26

Re: how to specify path to uploaded file to import

Oh my goodness, it worked!  Thank you so much Amy!  So is there a different forum area for SAS on demand?  I couldn't find it..

SAS Employee
Posts: 146

Re: how to specify path to uploaded file to import

You're in the right place.  There's just been a lot more traffic on University Edition.  To try to put a positive spin on it, this is something you'll deal with as you move around using SAS in different contexts - how do I point to my data?  So it's a good learning exercise to go through (I love that expression).  So when you're in a new job where you don't know their machines or the physical path to your data, having the right click / properties trick for SAS Studio will come in handy. 

☑ This topic is SOLVED.

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

Discussion stats
  • 10 replies
  • 2430 views
  • 3 likes
  • 6 in conversation