BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Solly7
Pyrite | Level 9

Hi, i need to output summary statistics of "Amount" variable, i need to print sum of amount for an each every month.  see my below data

 

table name = transactions_info

 

policy no    Amount     Date 

1                 300           201909

2                 600           201909

3                 900           201910

4                 100           201910

 

So i need summary output which looks like below

 

Date         Amount

201909    900

201910    1000

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20
data have;
input policyno Amount Date : yymmn6.;
format Date yymmn6.;
datalines;
1 300 201909
2 600 201909
3 900 201910
4 100 201910
;

proc summary data=have nway;
    class Date;
    var Amount;
    output out=want(drop=_:) sum=;
run;

Result:

 

Date    Amount
201909  900
201910  1000

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20
data have;
input policyno Amount Date : yymmn6.;
format Date yymmn6.;
datalines;
1 300 201909
2 600 201909
3 900 201910
4 100 201910
;

proc summary data=have nway;
    class Date;
    var Amount;
    output out=want(drop=_:) sum=;
run;

Result:

 

Date    Amount
201909  900
201910  1000
Solly7
Pyrite | Level 9

Thank you so much

Solly7
Pyrite | Level 9

thank you

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1078 views
  • 1 like
  • 3 in conversation