Hi all,
I have a dataset with different months. Each account number shows 1,2,3, etc which indicates the number of letters send to those accounts. I want to try to find the total number of letters send in each month. Basically, I want to get the sum like in March the total letter send is 2, in May it is 6. I tried the code mention below and it shows me for 1 month but when I try to add all months, its goes in not responding.
Proc sql;
select sum(FEBvols)
from No_Letter;
quit;
JANvols | FEBvols | MARvols | APRvols | MAYvols |
0 | 0 | 2 | 2 | 1 |
0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 5 |
Thank you. Don't make me ask repeatedly for data in the proper form.
proc means data=test sum;
var janvols--mayvols;
run;
May I suggest that you do not put calendar information into variable names. You would be far better off having a data set with a variable named MONTH which has the names of the months, or even better if this variable MONTH has a valid numeric SAS date value indicating the month.
Please provide data as working SAS data step code, as you have done in the past.
Hi,
data Test;
infile datalines dsd truncover;
input JANvols FEBvols MARvols APRvols MAYvols
;
datalines;
0 0 2 2 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 5
0 0 0 0 0
;
run;
Thank you. Don't make me ask repeatedly for data in the proper form.
proc means data=test sum;
var janvols--mayvols;
run;
May I suggest that you do not put calendar information into variable names. You would be far better off having a data set with a variable named MONTH which has the names of the months, or even better if this variable MONTH has a valid numeric SAS date value indicating the month.
Thank you. That worked!!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.