Hi All,
I am running SAS at Linux, I wonder whether there is a way to output the SAS dataset at Linux to CSV files at Local computer or shared drive. Thank you!
Jade
Yes, exactly the same methods can be used to output CSV as with any other operating system - e.g. datastep, proc export, proc print etc.
CSV is just a text file with a delimiter of a comma, it is not Excel!!
Proc Export with DBMS=CSV should write anywhere you have write permissions from the Linux system. Or are you asking for a specific Data Integration approach?
I am trying the file transfer between PC and SAS server, it works for excel file. I am wondering whether there is some ways that work for CSV file.
Syntax work for excel file:
proc import datafile="C:\test.xlsx"
out=work.TEST_server
dbms=excelcs replace;
server='********';
run;
Any suggestion for similar coding works for CSV file? Thank you!
Should be exactly the same:
proc import datafile="c:\test.csv" out=work.test_server dbms=csv replace; server='********'; run;
Do note though that using proc import is not ideal as it will try to guess your data. Use a datastep and specify each column, type, length, how to read it etc.
data test_server; infile "c:\test.csv" dlm=","; length vara $10. ....; format vara $10 ...; informat vara $10 ...; input vara $ ...; run;
when I try the syntax of "proc import" with csv file, I got an error at the "server" statement said "ERROR 180-322: Statement is not valid or it is used out of proper order."
I wonder usually how people try to transfer csv file from PC to SAS grid server? Thank you!
I will try the data step too.
Ah, ok, I suppose that is PCFiles Server then. As the file is plain text you should be able to ftp it directly across - I would generally use ftp for transferring any file. Maybe check with your IT, because if you can access the file, then you should be able to link via network path to it and just access the file directly. PCFiles server is used where one of the systems does not have Office installed, so needs some a sort of Office translator server to process. CSV is plain text and doesn't need this.
Yes, you are right, There is PCFiles server installed on my PC, and I am trying to transfer files between PC and SAS grid server. Somehow the ftp is not allowed in our SAS server for security purpose, it's really not convenient when I try to output my SAS data to CSV files.
are there any other options other than the ftp?
Thank you,
Jade
Speak with your IT group, I can't tell without seeing the setup, should just be a networking mapping. Don't know why ftp isn't allowed, ftp is a secure file transfer protocol. But anyways to you should be able to read/write directly to areas.
Thank you!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.