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.






The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.


Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 


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
  • 3 replies
  • 3 in conversation