I am trying to use a data step to populate two fields, based on the values of two other fields and I am running into issues. I have attached a sample of what I want my output to look like. I have highlighted the values that I want to populate and what I want those values to equal. Basically, I have a data set that is sorted by a claim number and a sequence number, so that the data is in chronological (transaction) order. For each claim number, when the status is 'Open', I want the Closed Date and the Reopen Date fields to be null. When the status changes from Open to Closed, I want to take the Book Date, which is a transaction date, and put it into the Closed Date field. Then, for each record after that where the status is = 'Closed', I want to use that first Book Date in the Closed Date field, until the status changes again. When the status changes to Reopen, I want to make the Close Date = null and the reopen date to equal the Book Date. I will then use that first Book Date value in each following record until the status changes again. Each time the status changes, I need to basically reset the date I am using to the value in the current record of the first change. I am using SAS EG 7.15 HF7 (7.100.5.6177) (64-bit) I started with this Do While Loop, but the last END; keeps flagging an error "No Matching DO/SELECT statement". DATA WORK.STATUS_LIST_1;
SET WORK.STATUS_LIST;
clmnum = ClaimNumber;
DO WHILE (clmnum = ClaimNumber);
If ClaimStatusCd NE 'Closed' THEN
OUTPUT;
ELSE
keepClosedDt = BookDt;
keepStatusCd = ClaimStatusCd;
ClosedDt = keepClosedDt;
OUTPUT;
END;
DO WHILE (keepStatusCd = ClaimStatusCd);
ClosedDt = keepClosedDt;
OUTPUT;
END;
END;
run;
... View more