Help using Base SAS procedures

proc export > csv on a UNIX platform

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

proc export > csv on a UNIX platform

Hello

 

I'm working with SAS 9.4 and I try to run via a shell a SAS script on a UNIX platform. Within the SAS script there is my most important step that is a proc export of a small dataset to csv. But my sas script stops miraculously just when the proc export should begin. Even my log file doesn't contain any errors, it just stops and that's it. All the datasets before the proc export are correctly created, the proc export and all the following datasteps are just ignored. If a replace the proc export by an ordinary datastep everything works fine again

 

Does anybody know what's happening?

 

Thanks in advance

Alex


Accepted Solutions
Solution
‎02-10-2018 03:59 AM
Super User
Posts: 10,209

Re: proc export > csv on a UNIX platform

Run the batch script with -logparm WRITE=IMMEDIATE for SAS.

And please post your proc export code.

Have you checked the log you get for any WARNINGs, ERRORs or extraneous NOTEs before it reaches the supposed export step? Make your code clean.

What happens when you run the same code in an interactive session?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

View solution in original post


All Replies
Solution
‎02-10-2018 03:59 AM
Super User
Posts: 10,209

Re: proc export > csv on a UNIX platform

Run the batch script with -logparm WRITE=IMMEDIATE for SAS.

And please post your proc export code.

Have you checked the log you get for any WARNINGs, ERRORs or extraneous NOTEs before it reaches the supposed export step? Make your code clean.

What happens when you run the same code in an interactive session?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 7

Re: proc export > csv on a UNIX platform

Posted in reply to KurtBremser

Hi Kurt,

 

Thank you for your answer.

 

Here is my proc export:

 

PROC EXPORT DATA= OUTT.CASES_&mannoc.

            OUTFILE = toto

            DBMS=DLM REPLACE;

                     DELIMITER=";" ;

                     PUTNAMES=YES;

RUN;

 

I can't recognize any problems, the macro variable &mannoc. is correctly assigned but it still doesn't work. Is there a problem with this kind of proc export on a Unix platform?

 

Thanks for information if you see anything.

 

Greetings

A.

Super User
Posts: 10,209

Re: proc export > csv on a UNIX platform

How does your filename statement for toto look?

Have you checked the log, as I suggested? And please supply the values of the macro variables used. If necessary, insert %put statements immediately before their use.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 7

Re: proc export > csv on a UNIX platform

Hello Kurt

 

I tried the following line in an emulator (putty): sas -logparm write=immediate bgsa_sedex_test.sas &. The result is that I have indeed

now a log file which gives me at the last place - juste after the proc export - the following ERROR message:

 

ERROR: The connection to the X display server could not be made. Verify that the X display name is correct, and that you have

access authorization. See the online Help for more information about connecting to an X display server.

 

This is a hint, I try to understand this message by googling, but what is missing then in my proc export procedure?

 

You will find here the whole proc export with the filename declaration :

 

filename toto '/data/dwh1/dwh/data/misc/seco/outest/finalds_alk0457.csv';

 

proc export data=outt.cases_&mannoc.

outfile=toto

dbms=dlm replace;

delimiter=";";

putnames=yes;

run;

 

Thanks in advance

Alecs

Occasional Contributor
Posts: 7

Re: proc export > csv on a UNIX platform

Hello

 

I found the solution of my problem!!

 

It's just an option that was missing in my shell script, the -noterminal option. Since I added it, proc export works again. Why proc export on a Unix platform tries to connect to the X server is another question but at least my script works now.

 

Thanks very much to Kurt for his input to make appear the error message in the logfile (-logparm write=immediate), this helped me to resolve this problem!

 

Greetings

Alecs

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 253 views
  • 1 like
  • 2 in conversation