BookmarkSubscribeRSS Feed

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;

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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%

Astounding
PROC Star

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.

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!

How to Concatenate Values

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.

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