Let me begin by saying I am just starting to learn how to program.
I have a good size dataset with 14017 observations and 375 variables.
There are 10 variables of interest where I want to delete different values (they are characters)
Variables are CONCPT1, CONCPT2, ans so forth until CONCPT10 and values are hundreds of different values (i.e. 32551, 32160, 38746, 21620 and so on).
I tried the IF then delete statement with success if I include one value such as:
data pd6; set pd5;
if CONCPT1 = '32551' then delete;
run;
However, I want to delete hundreds of values from different variables (CONCPT1 - CONCPT10) and when I try to include more I receive an error (missing an operator or an incorrect answer)
I tried including more values to the IF statement but the result is not accurate. For example:
data pd6; set pd5;
if CONCPT1 = '32551' '32160' '38746' then delete;
run;
Please let me know if I can be of any help with more information.
Thanks,
JG
You need an "IN" operator with comma in between.
data pd6; set pd5;
if CONCPT1 in ( '32551', '32160', '38746') then delete;
run;
You need an "IN" operator with comma in between.
data pd6; set pd5;
if CONCPT1 in ( '32551', '32160', '38746') then delete;
run;
Thank you so much!
@saslove wrote:
You need an "IN" operator with comma in between.
data pd6; set pd5;
if CONCPT1 in ( '32551', '32160', '38746') then delete;
run;
Commas are not required, blanks are sufficient.
Thank you so much! I will look into it!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.