BookmarkSubscribeRSS Feed
FaisalD
Calcite | Level 5
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 line..so 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!
Faisal
2 REPLIES 2
data_null__
Jade | Level 19
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.
FaisalD
Calcite | Level 5
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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 949 views
  • 0 likes
  • 2 in conversation