BookmarkSubscribeRSS Feed
dhuerta
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;
run;

3 REPLIES 3
ballardw
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.

 

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 732 views
  • 0 likes
  • 3 in conversation