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
Try moving the CSV to a metadata accessible location/folder
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
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;
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 .
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.