Reading CSV - SAS studio

Reply
New Contributor
Posts: 3

Reading CSV - SAS studio

Hello,

Could someone guide me on how to read CSV file into SAS STUDIO. I uploaded the file (which was originally excel file) in the navigation panel of SAS. My issue is, cannot get the file location in the infile statement. When I check under properties of the file to get the file path, I see "/folders/myfolders" but do not know the drive where it is saved.

Thanks,

Sim

Occasional Contributor slg
Occasional Contributor
Posts: 6

Re: Reading CSV - SAS studio

Try moving the CSV to a metadata accessible location/folder

SAS Super FREQ
Posts: 8,868

Re: Reading CSV - SAS studio


Hi:

  Let's assume that you have set up this structure of folders on your C: drive:

c:\SASUniversityEdition\myfolders

AND, let's assume that you have set that up as your shared folder location. Then under that structure, you have a subfolder called "mydata" and your CSV file (shown here as STUFF.CSV):

c:\SASUniversityEdition\myfolders\mydata\stuff.csv

  This is the Windows path to your shared folders location. You cannot use an INFILE statement that points to the C: drive path. That's because your SAS University Edition vApp is on a Linux Machine and it doesn't know about Windows locations. So you have to use a Unix/Linux path location:

INFILE '/folders/myfolders/mydata/stuff.csv' dlm=',' dsd;


Note how the c:\SASUniversityEdition portion of the Windows path turns into /folders in the Unix path. Then notice how the slashes are Unix slashes, not Windows slashes in the rest of the path specification.

 

If you do not know how to set up shared folders please read the documentation for your virtual machine software.

cynthia

New Contributor
Posts: 3

Re: Reading CSV - SAS studio

Posted in reply to Cynthia_sas

Thanks for your time Cynthia, below is the error I keep getting

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

42         ;

43         proc import datafile='folders/myfolders/Partial_1.csv'

44              out=value_1

45              dbms=csv

46              replace;

47              getnames=no;

48         run;

NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to

WORK.PARMS.PARMS.SLIST.

ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/folders/myfolders/Partial_1.csv.

ERROR: Import unsuccessful.  See SAS Log for details.

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

NOTE: PROCEDURE IMPORT used (Total process time):

       real time           0.35 seconds

       cpu time            0.41 seconds

      

49        

50         proc print data=value_1;

ERROR: File WORK.VALUE_1.DATA does not exist.

51         run;

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

NOTE: PROCEDURE PRINT used (Total process time):

       real time           0.02 seconds

       cpu time            0.04 seconds

      

52         ;

53         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

Trusted Advisor
Posts: 3,214

Re: Reading CSV - SAS studio

You are just missing a /. just before folders...         proc import datafile='/folders/myfolders/Partial_1.csv'

What happens: it did not find the file there

- The error on the /opt/sasinside/SASConfig/Lev1/SASApp/folders/myfolders/Partial_1.csv.   is not logical. It is tryind to find the file in your current directory. This location is not nicely friendly set.

- It did try to update something in the SASUSER for some reason also that one is locked.

Getting more errors on the wrong location .

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 4 replies
  • 861 views
  • 4 likes
  • 4 in conversation