- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
ChrisHemedinger, I am unable to run the code as it is throwing the same error. Do you have any other suggestions.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Post the complete (all code and messages) log of the failing step by copy/pasting the text into a code box opened with this button:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.