SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
buddha_d
Pyrite | Level 9

Dear SAS colleagues, 

                I have to import "CSV" file and I have working code for "ACCESS" file. Here is the sample code for access database (just 

proc import out = work.want
datatable= "GIVEN"
dbms = ACCESSCS replace;
database= "\\WELSFGO\KDRIVE$\Test_File.mdb"; 
server= 'WELSFGO.NETIZENS.BANK-DSb.COM';
port = 7845;
run;

I tried different ways to import similar kind of code like the one shown below.

proc import out=want
DATAFILE="\\WELSFGO\KDRIVE$\Test_File.csv"
dbms=csv replace; 

server= 'WELSFGO.NETIZENS.BANK-DSb.COM';
port = 7845;

run; 

I get the following error. 

 

ERROR: Import unsuccessful. See SAS Log for details.

 

I don't have any other details to know further. Could someone help me fix the syntax so that I  could import the csv file? 

 

Thanks in Advance!!!

 

 

5 REPLIES 5
ChrisHemedinger
Community Manager

You should not need the server and port options for CSV. That's for using PC Files Server, which helps you to import Microsoft file types like Excel or Access. SAS can read CSV files directly.  As long as your SAS session can get to the path where the CSV sits, it should work.

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
buddha_d
Pyrite | Level 9

ChrisHemedinger, I am unable to run the code as it is throwing the same error. Do you have any other suggestions. 

 

Thanks

 

Tom
Super User Tom
Super User

Your first PROC IMPORT step is accessing the server named WELSFGO.NETIZENS.BANK-DSb.COM via the SAS/ACCESS to PC-FILES process that is running on that machine.  The machine where SAS is running (not the machine you are using to run Enterprise Guide) is where the data is being imported into.

 

Is that machine with the CSV file on it also running some  other server process, like an SFTP service or HTTP service?  If so you could use one of those methods to copy the file over to the machine where SAS is running.  You could then read the CSV with SAS code.  You could even let PROC IMPORT guess how to read the file if for some reason you do not know what is in it.

 

If not then ask if the actual drive where the file you want lives is also mounted on the server where SAS is running.  Then you could just point to it directly.  

 

Or have the drive that has the data made visible on the machine where you are running Enterprise Guide.  Then you could either use the EG tool for importing a CSV file to move it to the SAS server.  Or use the file upload task of Enterprise Guide to copy it to the SAS server.

SASKiwi
PROC Star

Pulling data from a Windows server (WELSFGO.NETIZENS.BANK-DSb.COM) to your SAS Application server using EG is likely to be a permissions problem, not a syntax one. Your ACCESSCS program syntax looks OK. I suggest you engage with your SAS administrator as they have likely been involved in setting up this approach. Confirming your server name, port and folder share details is a good start. If this is a first time test then you could be blocked by server firewall rules. Only your IT folks can help with that as they need to make a rule change. By default servers usually block all communication ports, then add a rule for each port where traffic is allowed. Ask about a firewall rule for port 7845  on both servers.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 862 views
  • 0 likes
  • 5 in conversation