Can you exclude a row in a dataset in SAS? I know you can do it in JMP but can't find anything about it in SAS.
If the only option is to delete, how do I delete a row with specific variables? For example, the two rows I want to delete have the following categorical variables. This combination of variables makes those rows unique.
Row 1: Loc = A, Hyb=X03, Ntrt = High, Density = Low
Row 2: Loc = B, Hyb = X04, Ntrt = Low, Density = Low
Thanks
Something like this:
Data want ;
set have ;
if loc="A" and Hyb="X03" and Ntrt="High" and Density="Low" then delete ;
if loc="B" and Hyb="X04" and Ntrt="High" and Density="Low" then delete ;
run;
Something like this:
Data want ;
set have ;
if loc="A" and Hyb="X03" and Ntrt="High" and Density="Low" then delete ;
if loc="B" and Hyb="X04" and Ntrt="High" and Density="Low" then delete ;
run;
proc sql;
delete from my_dataset
where (Loc = 'A' and Hyb = 'X03' and Ntrt = 'High' and Density = 'Low')
or (Loc = 'B' and Hyb = 'X04' and Ntrt = 'Low' and Density = 'Low');
quit;
Or, if you just want to exclude those rows:
proc sql;
create table want as
select *
from my_dataset
where not (Loc = 'A' and Hyb = 'X03' and Ntrt = 'High' and Density = 'Low')
and not (Loc = 'B' and Hyb = 'X04' and Ntrt = 'Low' and Density = 'Low');
quit;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.