Which code segment generates the new data set, EX2, which contains a single record per subject and includes the Duration of Treatment?

This item will ask you to determine the missing code.

In the data shown below, each record represents a single treatment period and contains a character SUBJID and non-missing numeric dates EXSTDT and EXENDT.

The Duration of Treatment (in days) for a single period is defined as Treatment End Date – Treatment Start Date + 1. For each subject, the Total Duration (in days) is defined as the sum of durations of treatment across all treatment periods.

Which code segment generates the new data set, EX2, which contains a single record per subject and includes the Duration of Treatment?

data EX2

set EX;

by subjid exstdt exendt;

<insert code here>

run;
A . duration = exendt – exstdt + 1;
TotalDur = TotalDur + duration;
if first.subjid then TotalDur = duration;
if last.subjid;
B . retain TotalDur;
duration = exendt – exstdt + 1;
TotalDur = TotalDur + duration;
if first.subjid then Totaldur = duration;
if last.subjid;

C . retain TotalDur;
duration = exendt – exstdt + 1;
TotalDur = TotalDur + duration;
if first.exstdt then TotalDur = duration;
if last.exstdt;
D . duration = exendt – exstdt + 1;
TotalDur = TotalDur + duration;
if first.exstdt then TotalDur = duration;
if last.exstdt;

Answer: B

Latest A00-282 Dumps Valid Version with 145 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments