- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 09-15-2010 12:06 PM
(20537 views)
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;
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried using the PERCENT format?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
use the format percent12.2 or percent15.
ex:
proc sql;
create table a as select * a/b as c format percent12.2 from ;
quit;
ex:
proc sql;
create table a as select * a/b as c format percent12.2 from ;
quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks user4sas this was helpful, thanks for the example.
Fred
Fred
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks everyone