BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Sandeep77
Lapis Lazuli | Level 10

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
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Please provide data as working SAS data step code, as you have done in the past.

--
Paige Miller
Sandeep77
Lapis Lazuli | Level 10

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;

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Sandeep77
Lapis Lazuli | Level 10

Thank you. That worked!!