Convert numeric to %

Reply
anonymous_user
Posts: 0

Convert numeric to %

Hi,

Any idea how I can convert my count and balance into a percentage?

proc sql;
create table work.kptoverall_&A1. as
select distinct month_date,
count(*) as count,
sum(balance_outstanding) as balance,
avg(balance_outstanding) as average_balance

    from gbasel.basel&A2.

    where optimum_platform = 'Optimum'
and overall_multiplier >= 3
    and Overall_lit_stage_code not in ('L4','L5','L6')   

group by month_date;

quit;

Super User
Super User
Posts: 7,942

Re: Convert numeric to %

Posted in reply to anonymous_user

Hi,

Do you mean to put the result into a percentage format e.g.

count(*) as count format=percent7.1,

Or do you mean how to calculate a percentage?

anonymous_user
Posts: 0

Re: Convert numeric to %

Yes, i want the result in a percent rathr than a count or balance. RW9, i have tried to add the percent format as suggested but I get an error message - Tables with 0 columns are not supported by this object. Any ideas please?

Super User
Super User
Posts: 7,942

Re: Convert numeric to %

Posted in reply to anonymous_user

Sounds like your not getting data from the query.  Can I check what you mean however, can't really tell what you want from the text as its still vague between using a calculation to achieve a percent, or just adding % symbol?  Maybe post some test data and required output.

anonymous_user
Posts: 0

Re: Convert numeric to %

Below is the current output, at the moment im getting the numeric field but I have added a column to the right to show the %. I need to repance the numeric number (second column)and replace with the percentage (third column).

Volume (#)    

B       16,018  24%

R       16,669  25%

I       17,094  26%

R       16,206  25%

total         65,987  100%

Super User
Posts: 5,497

Re: Convert numeric to %

Posted in reply to anonymous_user

If all you need is a report showing the %, PROC TABULATE does that automatically without having to change the data.  If you actually need a data set holding the %, the answer will be very different.  If you are determined to create a data set, you will need to create grand totals to use as denominators in your % calculations.

Ask a Question
Discussion stats
  • 5 replies
  • 423 views
  • 0 likes
  • 3 in conversation