Help using Base SAS procedures

Exporting to Tab Delimited format issue

Reply
N/A
Posts: 0

Exporting to Tab Delimited format issue

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!
N/A
Posts: 0

Re: Exporting to Tab Delimited format issue

Posted in reply to deleted_user
N/A
Posts: 0

Re: Exporting to Tab Delimited format issue

Posted in reply to deleted_user
I do not have SAS Access, only the Base program.

Thanks for the suggestion!
N/A
Posts: 0

Re: Exporting to Tab Delimited format issue

Posted in reply to deleted_user
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.
Trusted Advisor
Posts: 2,116

Re: Exporting to Tab Delimited format issue

Posted in reply to deleted_user
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
Ask a Question
Discussion stats
  • 4 replies
  • 144 views
  • 0 likes
  • 2 in conversation