Hi, I am looking for sas procedure or sas function that similar to excel sumifs function. I would to sum _FREQ_ in terms of msa_code_all and Auditor_Key where previousyear< yearend <= yearend So for msa_code_all(10100) and Auditor_Key(27) sum of freq should be 8(5+2+1) because yearends of three rows are smaller thanpreviousyear. Sumifs function is in G column =SUMIFS(D$2:D$21,$A$2:$A$21,"="&$A3,$B$2:$B$21,"="&$B3,$C$2:$C$21,"="&$C3,$E$2:$E$21,"<="&$E3,$E$2:$E$21,">"&$F3). So far, I came up with the below code but does not work. Can you help me? proc summary data=example nway; class Auditor_Key msa_code_all var _FREQ_; where previousyear < yearend <= yearend ; outputout=testsum sum=; run; msa_code_all SIC2 Auditor_Key _FREQ_ yearend previousyear Sum of Freq 10100 67 27 5 20100301 20090301 8 10100 67 27 2 20100201 20090201 0 10100 67 27 1 20100101 20090101 1 10100 67 27 1 20031201 20021201 1 10180 36 846 1 20040901 20030901 1 10180 36 846 1 20030901 20020901 1 10180 46 846 1 20011201 20001201 1 10180 60 846 2 20110601 20100601 2 10180 60 846 1 20100601 20090601 1 10180 60 846 2 20090601 20080601 2 10180 60 846 1 20080601 20070601 1 10180 60 846 1 20070601 20060601 1 10180 60 846 1 20060601 20050601 1 10180 51 1091 1 20041201 20031201 1 10180 51 1091 1 20031201 20021201 1 10180 51 1091 1 20021201 20011201 1 10180 67 1091 1 20041201 20031201 1 10180 67 1091 1 20031201 20021201 1 10180 67 1091 1 20021201 20011201 1 10420 7 2 2 20111201 20101201 2
... View more