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;
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?
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?
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.
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%
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.