BookmarkSubscribeRSS Feed
Ndiritu
Calcite | Level 5

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

4 REPLIES 4
slg
Obsidian | Level 7 slg
Obsidian | Level 7

Try moving the CSV to a metadata accessible location/folder

Cynthia_sas
SAS Super FREQ


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

Ndiritu
Calcite | Level 5

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;

jakarman
Barite | Level 11

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 --<-----

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 4 replies
  • 1645 views
  • 4 likes
  • 4 in conversation