I think what your SQL code does is something like this:
Data data_final;
length
line 8
rpt_order 8
MBR_MAID $15
Member_id $15
Member_Name $255
Provider_Name $255
Network_Status $255
CHECK_NUMBER $25
CHECK_DATE 8
CLAIM_ID $12
REVENUE_CODE 8
Service_Description $255
DIAGNOSIS_CODES $255
SERVICE_FROM_DT 8
SERVICE_THROUGH_DT 8
SUM_OF_DAYS 8
SUM_OF_CLAIM_AMT 8
SUM_OF_PAID_AMT 8
PAYOR $255
Rate 8
;
format
line 8.0
rpt_order 8.0
CHECK_DATE yymmdd10.
SERVICE_FROM_DT yymmdd10.
SERVICE_THROUGH_DT yymmdd10.
;
keep line--rate;
set data_order(in=base) data_totals(in=sum);
by MBR_MAID;
line=_N_;
if base then do;
rpt_order=Member_Order;
Member_id=MBR_MAID;
Network_Status='In Network';
Service_Description='MH-InPatient-Psychiatric Srvcs R&B';
end;
else do;
rpt_order=Member_Order;
Member_id=0;
call missing(Member_Name,Provider_Name,Network_Status,CHECK_NUMBER,CHECK_DATE,CLAIM_ID,REVENUE_CODE,Service_Description,SERVICE_FROM_DT,SERVICE_THROUGH_DT,PAYOR,Rate);
DIAGNOSIS_CODES='Total';
end;
run;
The first lines (down to and including the KEEP statement) is analogue to the CREATE TABLE statement.
The code assumes that both DATA_ORDER and DATA_TOTALS are sorted by MBR_MAID.
... View more