The SAS Output Delivery System and reporting techniques

Issue with using a formatted Put statement

Occasional Contributor
Posts: 5

Issue with using a formatted Put statement

Hi there,

I'm having an issue with a formatted put statement I'm using to write a csv file.
Basically I'm writing out a csv from a dataset.

I have a macro variable such as:

%let c = +(-1) ',';

and in my put statement I'm calling the following:
put myDateVar : yymmddS10. &c
someTxt1 &c
someTxt2 &c

etc etc..

It writes out the file fine but on one random row each time I run this it will cause an issue. In the middle of some variable it will restart the row becomes mis-alligned and doesn't have the proper data and actually ends up with more data than it should. the log shows no error or warning message. This seems to happen on UNIX only. I run the exact same thing under windows and it works perfectly.

the output might look something like this for example:

2009/01/01,some text1,some text1
2009/01/02,some text2,some text2
2009/01/03,some text2009/01/03,some text3,some text3
2009/01/04,some text4,some text4

Has anyone ever seen anything like this before?
Thank you in advance!
Respected Advisor
Posts: 3,777

Re: Issue with using a formatted Put statement

I don't know the answer to the specific problem you are having. If you post example data and more code perhaps that someone could test it.

However, have you considered using the FILE statement option DSD. It will hande the delimiter for you, you just need a PUT statement that uses list or formated list put.
Occasional Contributor
Posts: 5

Re: Issue with using a formatted Put statement

I actually solved it just now. It seems to have been an issue with the FTP client I am using. Not a SAS issue after all. Sorry for the false alarm.
Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation