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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 942 views
  • 1 like
  • 3 in conversation