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
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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