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 ;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.