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

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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