×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Formatting Excel Columns

Formatting Excel Columns

Formatting Excel Columns

(OP)
I am stuck.. I am trying to export to an excel file (which works fine)

but i cannot get the text column to remain as text.
instead of 7568626110106 i get 7.56863E+12

I found one solution but it forces EVERYTHING to text.. no good since then the number columns dont add.

ODS CHTML FILE="VRFD_&FILENAME..xls"  HEADTEXT="<STYLE> TD {MSO-NUMBER-FORMAT:\@}</STYLE>"  PATH="/home/xxxxxxxx/check_output/";
TITLE;
PROC PRINT DATA=POUT NOOBS;
RUN;
ODS CHTML CLOSE;

I cant seem to get it to work correctly.

thanks!

RE: Formatting Excel Columns

That field is formatted as a character in the SAS dataset, correct? (i.e. - $20 or something similar)

I don't use ODS very much so I don't know if that is what is causing that, but I have used proc export and the Excel libname engine with good success to export long numbers that have been formatted as a character.

Dave

RE: Formatting Excel Columns

(OP)
I actually figured it out! Havent tried the libname export..(and yes, they are formatted text in the dataset)

Creating an html output, and using the htmlstyle on the text columns ensures they come out as text!!!!!
Took HOURS of testing and tweaking and testing last night lol. in case anyone is interested:

http://www2.sas.com/proceedings/sugi28/012-28.pdf

has the code that i based it on... a few tweaks and it worked!

ODS HTML FILE="VRFD_&FILENAME..xls" PATH="/home/xxxxxxx/check_output/";

      TITLE;

      PROC PRINT DATA=POUT NOOBS;

      var NETWORK_COST;

      var NC_Val;

      var DOCUMENT_NUM / style(column)={htmlstyle="MSO-NUMBER-FORMAT:\@"};

      var SUPPLIER;

      var SUP_SITE / style(column)={htmlstyle="MSO-NUMBER-FORMAT:\@"};

      var SUPPBANK / style(column)={htmlstyle="MSO-NUMBER-FORMAT:\@"};

      var PAY;

      var DOCAMT;

      var SEQNUM;

      var INV_NUM / style(column)={htmlstyle="MSO-NUMBER-FORMAT:\@"};

      var INVOICE_DT;

      var BAN / style(column)={htmlstyle="MSO-NUMBER-FORMAT:\@"};

      var GROSSAMT;

      var DISCAMT;

      var PAYAMT;

      var IPAY;

      RUN;

ODS HTML CLOSE;

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close