In SAS entreprise Guide I want to export a table as a CSV file to a FTP server. I'm saving the table as a csv on my SAS server and then want to export it.
I'm defining the FTP connection and want to write my file in the 'SAS' folder on this FTP
filename myftp ftp host='hostname' cd='/SAS/'
user='username' pass='password'
debug;
Afterwards I'm exporting my table to a csv file on my sas server and assigning a filename to this csv file
proc export data=WORK.TABLE_DATA
outfile="/sas/prd/data/output/Test.csv"
dbms=csv
replace;
run;
filename csv_file "/sas/prd/data/output/Test.csv";
Then I'm exporting this csv to the server
proc export
file=myftp outfile=csv_file
dbms=csv replace;
run;
Script runs succesful but no file appears when I'm checking in the FTP. Is there any mistake in how I define the FTP reference? Or in the export step? Or both?
Thanks in advance
As Tom mentioned in his comment, PROC EXPORT
only exports SAS datasets to other formats. In addition, the filename statement for ftp is missing some elements, here's an example where we're writing a file called 'Test.csv' in the '/SAS/' directory, with numbers 1 to 10:
filename create ftp 'Test.csv' cd='/SAS/'
host='hostname'
user='user' password="password";
data _null_;
file create;
do i=1 to 10;
put i=;
end;
run;
You may be able to try using PROC EXPORT
with the fileref from the filename ftp
statement, however I don't have a SAS installation or FTP server handy for testing:
filename create ftp 'Test.csv' cd='/SAS/'
host='hostname'
user='user' password="password";
proc export data=WORK.TABLE_DATA
outfile=create
dbms=csv
replace;
run;