BookmarkSubscribeRSS Feed
Calcite | Level 5

I’m trying to delete certain data with variables not equal to one, but the below code deletes all the data. I can’t figure out the OR statement so that not all the data is deleted. I’m running a relative risk analysis and have included that code for reference


ata hf8mb;
set hf8;
time = 0 ;
if timelapse < .8 then delete;
if surver = 'BIT1' then delete;
if met_brst_scrn ne 1 then delete;
if met_cer_scrn ne 1 then delete;
if met_cer_scrn ne 1 then delete;
if met_co_scrn ne 1 then delete;
if met_pneu_vac ne 1 then delete;
if met_hpv_vac ne 1 then delete;
if met_flu_vac ne 1 then delete;
keep time par_id.... 


proc freq data=hf8m3 order=data;
tables time*need_brst_scrn / relrisk;

Super User

The SAS DELETE statement removes observations.


Are you intending to set values to missing so they are not included in analysis?

Might be a good idea to show an example of your data and what you expect the result to look like AFTER this process is done.





Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 3 in conversation