BookmarkSubscribeRSS Feed
Jade_SAS
Pyrite | Level 9

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

9 REPLIES 9
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

ballardw
Super User

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?

Jade_SAS
Pyrite | Level 9

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!

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;
Jade_SAS
Pyrite | Level 9

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.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Jade_SAS
Pyrite | Level 9

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 9 replies
  • 1859 views
  • 0 likes
  • 3 in conversation