09-29-2015 02:20 PM
Hi, I need to use SAS to get a .csv file using SFTP and load it into a table. I have the pub key and connection setup properly and able to get the file with the following statements. However, all data including the column header are in 1 column in the reciving table. How can I load the data into .csv file that get from the site and load it into a SAS dataset with first row as column header? I also need to rename the file after I read it. Is there anyway I can include some sftp command in my SAS script. Please advise...
Filename SITE1 SFTP "/data/NM_TEST_20150911.csv"
Host="220.127.116.11" user="r_test" ;
infile site1 truncover;
input a $5000.;
09-29-2015 02:38 PM
Since you say the file is a CSV, I'm assuming that there commas between the columns. Where are they placed in the file? Please provide a sample record of the data in the file.
09-29-2015 03:47 PM
If the filename statement works without problems you can use the data import wizard as a start indicating teh fileref SITE1 as the source and name the output, Library and dataset as desired.
If that works at all then the datastep code in the Log can be copied and modified to provide a bit more control of the resulting data set.