SAS Procedures

Help using Base SAS procedures
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 7 replies
  • 20538 views
  • 0 likes
  • 5 in conversation