I Have data set with below data example format,
I want to ouput in disinct member who is having service date and with in days and status. I am using below code. but I am still in correct data. Thank you in advance.
I need final data to be like below
Mbr_ID F_NM L_NM CLM_TYP SRVC_DT DAYS CMPL_STS
111 A Z LAB 1/1/22 21 with in 40 days
123 B Y MED 2/2/22 41 After 40 day
Actual data in table
Mbr_ID F_NM L_NM CLM_TYP SRVC_DT DAYS CMPL_STS
111 A Z LAB 1/1/22 21 with in 40 days
111 A Z MED not meeting condition
123 B Y LAB not meeting condition
123 B Y MED 2/2/22 41 After 40 day
Code
proc sort data =a;
by mbr_id SRVC_DT DAYS;
quit;
data b;
set a;
by mbr_id SRVC_DT DAYS;
if first.mbr_id and first.sevc_dt and first.days;
run;
It is not clear what you have and what you want, also please post data in usable form.
Maybe you all you need is a where statement:
data want;
set have;
where not missing(SRVC_DT) and not missing(DAYS);
run;
I don't think it is clear what you're trying to do. However, I think this is close.
data have;
input Mbr_ID F_NM $ L_NM $ CLM_TYP $ SRVC_DT :ddmmyy10. DAYS CMPL_STS :$50.;
infile datalines dlm = '|';
format SRVC_DT ddmmyy10.;
datalines;
111|A|Z|LAB|1/1/22|21|with in 40 days
111|A|Z|MED| | |not meeting condition
123|B|Y|LAB| | |not meeting condition
123|B|Y|MED|2/2/22|41|After 40 day
;
proc sql;
create table want as
select distinct *
from have
where SRVC_DT and DAYS
group by Mbr_ID
having max(SRVC_DT) = SRVC_DT
;
quit;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: