BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

proc sql;

create table action as

select distinct Region,count(ln_no) as ln, sum(balance) as bal

from main;

where region = 'West';

quit;

Sample output is

Region             ln                          bal

West           2500                     2300000

I created a proc tabulate with the intention of capturing both the count of the ln_no and the sum of the balance

Proc tabulate data=action order= data format=10. S=[cellwidth=150];

  Class Region;
  Var ln;
  Table Region=' ' all={label='Grand Total' S=[background = lightblue cellwidth=160]} *[STYLE=[Font_Weight=BOLD]],
        Region='Status '*ln=' '*sum=' '
        all={label='Grand Total' S=[background = lightblue]} *[STYLE=[Font_Weight=BOLD]] *ln=' '*sum=' ' / box='Investor Group';
  TITLE 'Loan Status';


My results give me a summary of the count of the loan however I am not getting the total or sum of the balance.  Essentially I am getting the 2500 but not the 2300000.  In addition how would I format the bal so it reads as a dollar format such as $2,300,000.00

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

  I already gave a partial answer in the other forum where you posted this question. Short version: BAL needs to be USED in VAR statement and TABLE statement to show up in output.

cynthia

Q1983
Lapis Lazuli | Level 10

Thanks that was a typo to repeat this

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 719 views
  • 0 likes
  • 2 in conversation