BookmarkSubscribeRSS Feed
MikeXue
Calcite | Level 5

Hello, 

I have an issue with my data sub setting. I want to keep records of subjects who are not Black or African American Screen Failures subjects. 

 

I used the following code: 


data adsl2;
set adsl;
where RACE ne "BLACK OR AFRICAN AMERICAN" and ARM ne "Screen Failure";
run;

 

However, for when I use this code it will only keep subjects who are not Black or African American and subjects who are not Screen Failures. How do I modify the code so that only Black Screen Failure subjects are dropped from the dataset? 

 

Thanks,

Michael 

1 REPLY 1
ballardw
Super User

Perhaps

 

 

data adsl2;
   set adsl;
   where not( RACE = "BLACK OR AFRICAN AMERICAN" and ARM = "Screen Failure");
run;

no data example means code cannot be tested.

 

Another way

data adsl2;
   set adsl;
   IF  RACE = "BLACK OR AFRICAN AMERICAN" and ARM = "Screen Failure" then delete;
run;

 

 


@MikeXue wrote:

Hello, 

I have an issue with my data sub setting. I want to keep records of subjects who are not Black or African American Screen Failures subjects. 

 

I used the following code: 


data adsl2;
set adsl;
where RACE ne "BLACK OR AFRICAN AMERICAN" and ARM ne "Screen Failure";
run;

 

However, for when I use this code it will only keep subjects who are not Black or African American and subjects who are not Screen Failures. How do I modify the code so that only Black Screen Failure subjects are dropped from the dataset? 

 

Thanks,

Michael 


 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 313 views
  • 0 likes
  • 2 in conversation