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="142.172.162.252" user="r_test" ;
Data temp;
infile site1 truncover;
input a $5000.;
run;
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.
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.
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: