BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

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

2 REPLIES 2
ballardw
Super User

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.

Cynthia_sas
Diamond | Level 26
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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1718 views
  • 2 likes
  • 3 in conversation