Looking for members with over X$ claims in 2014
This query is pulling the members but is not filtering only to 2014, do I not have the date in the correct place?
proc sql;
create table TOTAL_PAID as SELECT DISTINCT MBR_SYS_ID,
SUM(SRC_PD_AMT) as TOTAL_CLAIMS FROM DB2.INS_CLAIM A
WHERE A.CLM_PD_DT >= '01JAN2014'd and A.SRVC_CURR_IND = 'Y' and A.ENCTR_CD NOT IN('3','4','U') and A.TRANS_CD ='00'
group by MBR_SYS_ID
having TOTAL_CLAIMS > 100000;
quit;
I believe you need to subclause the where statement, then this would feed back into your outer loop for grouping. Also, if you are still not getting anything then copy the subclause with the where into another proc sql, see what it returns. Also you can try dropping the having and seeing what you get then.
proc sql;
create table TOTAL_PAID as
SELECT DISTINCT MBR_SYS_ID,
SUM(SRC_PD_AMT) as TOTAL_CLAIMS
FROM (select *
from DB2.INS_CLAIM
WHERE A.CLM_PD_DT >= '01JAN2014'd and A.SRVC_CURR_IND = 'Y' and A.ENCTR_CD NOT IN('3','4','U') and A.TRANS_CD ='00') A
group by MBR_SYS_ID
having TOTAL_CLAIMS > 100000;
quit;
I believe you need to subclause the where statement, then this would feed back into your outer loop for grouping. Also, if you are still not getting anything then copy the subclause with the where into another proc sql, see what it returns. Also you can try dropping the having and seeing what you get then.
proc sql;
create table TOTAL_PAID as
SELECT DISTINCT MBR_SYS_ID,
SUM(SRC_PD_AMT) as TOTAL_CLAIMS
FROM (select *
from DB2.INS_CLAIM
WHERE A.CLM_PD_DT >= '01JAN2014'd and A.SRVC_CURR_IND = 'Y' and A.ENCTR_CD NOT IN('3','4','U') and A.TRANS_CD ='00') A
group by MBR_SYS_ID
having TOTAL_CLAIMS > 100000;
quit;
Ok, reran and checked------the total amount of claim spend is correct.
The query is returning all claims regardless of date but only calculating the total on 2014.
Is there a way to remove the results that are not applicable (2012-2013)?
Are you sure you have members with total claims more than 100000 in 2014?
Yes, I am trying to narrow down because I am returning many with over $1million because its pulling in 2012, 2013 etc.
Could "A.CLM_PD_DT" be a "datetime" variable instead of "date" variable? Add datepart( A.CLM_PD_DT) to see if produce what you are expecting.
Haikuo
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!
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.