DATA Step, Macro, Functions and more

Trying to format column Proc Report using ODS TAGSETS.EXCELXP to character to keep leading zeros.

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 82
Accepted Solution

Trying to format column Proc Report using ODS TAGSETS.EXCELXP to character to keep leading zeros.

[ Edited ]

I have researched  the communities board on this and found learned that character data is changed to numeric data when it is output to excel via ODS.  I have an 'ID' column which is a character format and can contain leading zeros.  I am using PROC REPORT.  I can't find any examples when using this.   I have tried the following but it does not work.  Maybe I am placing the tagattr in the wrong place?  Any help would be appreciated!!

ORIGINAL
proc report data=work.EOM_ACCCOUNTS;
columns ID;

Define ID     / display 'Entity ID' LEFT 
style(column)=[font_size=8pt width=.5in]
style(header)=[font_size=8pt font_face='Times' font_weight=bold just=LEFT];

CHANGED:
proc report data=work.EOM_ACCCOUNTS;

columns ID;

Define ID     / display 'Entity ID' LEFT style={tagattr='Format:@'}

 


Accepted Solutions
Solution
‎03-04-2016 10:30 AM
Frequent Contributor
Posts: 82

Re: Trying to format column Proc Report using ODS TAGSETS.EXCELXP to character to keep leading zeros

Thanks Ksharp!   I got it to work after trying many different ways.  This is how I wound up getting the leading zeros:

 

Define ID / display 'Entity ID'

style(column)=[font_size=8pt width=.7in tagattr='Format:@']

style(header)=[font_size=8pt font_face='Times' font_weight=bold just=LEFT];

 

I think my problem was I was trying to keep the '{' character inside the [font....].  When I removed the '{', it worked!

View solution in original post


All Replies
Frequent Contributor
Posts: 82

Re: Trying to format column Proc Report using ODS TAGSETS.EXCELXP to character to keep leading zeros

[ Edited ]

My copy/paste did not get all of the lines intended for under the 'CHANGED' for the code. Here are all the lines:

Define ID / display 'Entity ID' LEFT style={tagattr='Format:@'}

Super User
Posts: 9,662

Re: Trying to format column Proc Report using ODS TAGSETS.EXCELXP to character to keep leading zeros

Maybe you could try 

 

style={tagattr='Format:000,000'}

 

Solution
‎03-04-2016 10:30 AM
Frequent Contributor
Posts: 82

Re: Trying to format column Proc Report using ODS TAGSETS.EXCELXP to character to keep leading zeros

Thanks Ksharp!   I got it to work after trying many different ways.  This is how I wound up getting the leading zeros:

 

Define ID / display 'Entity ID'

style(column)=[font_size=8pt width=.7in tagattr='Format:@']

style(header)=[font_size=8pt font_face='Times' font_weight=bold just=LEFT];

 

I think my problem was I was trying to keep the '{' character inside the [font....].  When I removed the '{', it worked!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 264 views
  • 1 like
  • 2 in conversation