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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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