Hi everyone,
I'm interested in keeping only BR-based regimens (1L,2L,3L) and remove other regimens from the dataset. I'm not interested in distinct observations by patient ID but rather all LOTs for BR-based regimen. I'm not sure how to go about this. Any insight would be helpful.
Following is the data I have -
ID | DRUG_REGIMEN | LOT | regimen |
1 | Bortezomib | 1L | Chemo monotherapy |
1 | 2L | ||
1 | 3L | ||
2 | Lenalidomide | 1L | Chemo monotherapy |
2 | 2L | ||
2 | 3L | ||
3 | Bendamustine + Rituximab | 1L | BR-based |
3 | 2L | ||
3 | 3L | ||
4 | Bendamustine + Rituximab | 1L | BR-based |
4 | 2L | ||
4 | 3L | ||
5 | Vincristine | 1L | Chemo monotherapy |
5 | Methotrexate | 2L | Chemo monotherapy |
5 | Methotrexate + Vincristine | 3L | Other chemotherapy |
5 | Cyclophosphamide + Doxorubicin + Rituximab + Vincristine | 1L | RCHOP/CHOP-based |
5 | 2L | ||
5 | 3L | ||
6 | Bendamustine + Rituximab | 1L | BR-based |
6 | 2L | ||
6 | 3L |
Data I want -
ID | DRUG_REGIMEN | LOT | regimen |
3 | Bendamustine + Rituximab | 1L | BR-based |
3 | 2L | ||
3 | 3L | ||
4 | Bendamustine + Rituximab | 1L | BR-based |
4 | 2L | ||
4 | 3L | ||
6 | Bendamustine + Rituximab | 1L | BR-based |
6 | 2L | ||
6 | 3L |
In the absence of sample data in the form of a working DATA step, this code is untested, but straightforward:
data want;
merge have (where=(LOT='1L' and regimen='BR-based') in=include)
have;
by id;
if include=1;
run;
It assumes:
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.