The SAS Output Delivery System and reporting techniques

Percentage display adding zeros in ODS

Reply
Frequent Contributor
Posts: 135

Percentage display adding zeros in ODS

data test (keep=pct);

set test1;

run;

sample output

100

50

70

 

In ODS i have this

DEFINE pct /DISPLAY style(column)={tagattr='format:#0%'} "%Processed";

 

My output looks like this

%Processed
1000%

5000%

7000%

I am getting the desired percent sign however I am getting two extra zeros.  How can I get rid of the extra zeroes

Super User
Posts: 11,101

Re: Percentage display adding zeros in ODS

PERCENT format is intended for values of 0 to 1 where 1=100%. So either divide your numbers by 100 or use a custom picture format to add a % at the end of any value.

SAS Super FREQ
Posts: 8,814

Re: Percentage display adding zeros in ODS

Hi:
In addition, when you use a format such as you show in TAGATTR, Excel automatically does a multiply by 100...please see this paper: https://support.sas.com/resources/papers/proceedings11/266-2011.pdf where data on page 16 is shown as 0.099 and 0.082 and with a tagattr similar to yours, Excel displays the number as though it has been multiplied by 100.

--- Including a percent sign in TAGATTR format without a backslash will cause Excel to multiply the number by 100. Example:
.1234 internal value with TAGATTR of 0.0#% will be displayed as 12.34%

---Including a percent sign WITH a backslash in the format will display the percent sign, but will NOT multiply the number by 100. Example:
.5678 internal value with TAGATTR of 0.00\% will be displayed as 0.57%

cynthia
Ask a Question
Discussion stats
  • 2 replies
  • 183 views
  • 2 likes
  • 3 in conversation