apologies for the hassle I have just two simple questions.
data r8; set r7; if siccd in (131,170, 195, 204); run;
data r8; set r7; if siccd ne (2100-2199); run;
could u plz help??
data r8;
set r7;
if siccd in (131,170, 195, 204) then delete;
run;
data r8;
set r7;
if sicced in (2100:2199) then delete;
run;
data r8; set r7; if siccd in (131,170, 195, 204); run;
As written says to KEEP records only with that value.
To delete RECORDS with that value
data r8; set r7; if siccd in (131,170, 195, 204) then delete; run;
I am not sure if you want to delete records with the values you are giving or if you want to set the value to missing (no value for the variable)
It is usually a good idea to post a few rows of data, some with the values of interes and some without, and what the desired outcome should look like.
From your post you want to delete rows with those values in siccd.
OK just insert the word NOT into your code before the IN(
Data r8; set r7; if siccd NOT in (131,170, 195, 204); run;
The other is a range not an IN( list so that is a subsetting IF condition like
if 2100 LE siccd LE 2199 then delete ;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.