SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

How to output SAS dataset to csv files at Linux server

Reply
Regular Contributor
Posts: 213

How to output SAS dataset to csv files at Linux server

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

Super User
Super User
Posts: 9,193

Re: How to output SAS dataset to csv files at Linux server

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!!

Super User
Posts: 12,994

Re: How to output SAS dataset to csv files at Linux server

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?

Regular Contributor
Posts: 213

Re: How to output SAS dataset to csv files at Linux server

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!

Super User
Super User
Posts: 9,193

Re: How to output SAS dataset to csv files at Linux server

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;
Regular Contributor
Posts: 213

Re: How to output SAS dataset to csv files at Linux server

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.

Super User
Super User
Posts: 9,193

Re: How to output SAS dataset to csv files at Linux server

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.

Regular Contributor
Posts: 213

Re: How to output SAS dataset to csv files at Linux server

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

Super User
Super User
Posts: 9,193

Re: How to output SAS dataset to csv files at Linux server

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.

Regular Contributor
Posts: 213

Re: How to output SAS dataset to csv files at Linux server

Thank you!

Ask a Question
Discussion stats
  • 9 replies
  • 275 views
  • 0 likes
  • 3 in conversation