BookmarkSubscribeRSS Feed
fredbell
Fluorite | Level 6
How can i convert this decimal outcome to show percent %


proc sql;
create table test as
select _NAME_,
case
when (Y__Service_Level)=(BR_PercentServiceLevel)then 0
else Y__Service_Level - BR_PercentServiceLevel
end as PercentServiceLevel
from cscore.BRSmerge;
quit;
7 REPLIES 7
ArtC
Rhodochrosite | Level 12
Have you tried using the PERCENT format?
deleted_user
Not applicable
use the format percent12.2 or percent15.

ex:
proc sql;
create table a as select * a/b as c format percent12.2 from ;
quit;
fredbell
Fluorite | Level 6
Thanks user4sas this was helpful, thanks for the example.

Fred
fredbell
Fluorite | Level 6
Hello again

I'm looking for some doc. to help explain how the format percent12.2 works

How do i figure out to apply 12.2 or 8.1 or what?

If you can lead me to some information that would be great, i've looked online but can't find anything.

Thanks again.

Fred
art297
Opal | Level 21
Fred,

The documentation can be found at: http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#a000205182.htm

or, if that wraps, in short form: http://xrl.us/bhznnr

In short, the first number indicates the width you want (including after the decimal), while the second number indicates the number of decimal places wanted.

HTH,
Art
Cynthia_sas
SAS Super FREQ
And, if you are using the PERCENT format, be sure to make the overall width "wide" enough -- usually 8.1 works for me if I have 1 decimal place:
From the Doc:
Tip: The width of the output field must account for the percent sign (% ) and parentheses for negative numbers, whether the number is negative or positive.


cynthia
fredbell
Fluorite | Level 6
Thanks everyone

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 7 replies
  • 19171 views
  • 0 likes
  • 5 in conversation