BookmarkSubscribeRSS Feed
SSK_011523
Calcite | Level 5

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 - 

IDDRUG_REGIMENLOTregimen
1Bortezomib1LChemo monotherapy
1 2L 
1 3L 
2Lenalidomide1LChemo monotherapy
2 2L 
2 3L 
3Bendamustine + Rituximab1LBR-based
3 2L 
3 3L 
4Bendamustine + Rituximab1LBR-based
4 2L 
4 3L 
5Vincristine1LChemo monotherapy
5Methotrexate2LChemo monotherapy
5Methotrexate + Vincristine3LOther chemotherapy
5Cyclophosphamide + Doxorubicin + Rituximab + Vincristine1LRCHOP/CHOP-based
5 2L 
5 3L 
6Bendamustine + Rituximab1LBR-based
6 2L 
6 3L 

 

Data I want - 

IDDRUG_REGIMENLOTregimen
3Bendamustine + Rituximab1LBR-based
3 2L 
3 3L 
4Bendamustine + Rituximab1LBR-based
4 2L 
4 3L 
6Bendamustine + Rituximab1LBR-based
6 2L 
6 3L 
1 REPLY 1
mkeintz
PROC Star

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:

  1. Data are sorted by ID.
  2. The indicator of a desired ID is to have an observation with LOT='IL' and regiment='BR-bases'.
  3. You want the entire collection of obs for such ID's.
--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 155 views
  • 0 likes
  • 2 in conversation