BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I'm using a data _null_ statement to output multiple scores into a tab delimited file. Everything is turning out great but there is a leading space before every column except the first one (when opened in Excel).

Is there anyway to put some kind of format in the FILE line to make it not put in that extra blank space? It seems like the data is right justified and it needs to be left justified.

Any fix would need to be for SAS base only.

Thanks for any help!
4 REPLIES 4
deleted_user
Not applicable
I do not have SAS Access, only the Base program.

Thanks for the suggestion!
deleted_user
Not applicable
However, that note is about Proc Export (Base) and Excel:

PROC EXPORT, when exporting data to Excel, preceeds each character value that is written out with a single leading quote. This is the proper behavior, and began with the original Lotus applications. The spreadsheet format was originally designed for numeric data and mathematical functions. Since a spreadsheet would take only numbers, in order to enter an alpha character (it was called a Label), you had to preceed the entry with a single-quote.

This single quote is not part of the text value, however. It is just displayed in the contents box. There are no settings or options in PROC EXPORT (or the Export Wizard) that will alter the behavior, but it
should not cause any issues with the data in Excel.
Doc_Duke
Rhodochrosite | Level 12
Are you doing this with the PUT statement?

If so, a trick to get rid of the leading blank is to add a pointer that adds "-1" to the output.

So if you used
tab='09'x;
PUT vara tab varb tab varc;

change it to

tab='09'x;
m1= -1;
PUT vara +m1 tab +m1 varb +m1 tab +m1 varc;

The SAS macro DS2CSV may also do it:
http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a002683390.htm

Doc

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 845 views
  • 0 likes
  • 2 in conversation