DATA Step, Macro, Functions and more

Delete line with a similar word

Accepted Solution Solved
Reply
Highlighted
Occasional Contributor
Posts: 14
Accepted Solution

Delete line with a similar word

I have a column with multiple lines.

 

Many contents are similar with the word "export" present in the column "Reason", example:

 

at line 1 there is = Export to Canada

at line 2 there is = export Mexico

at line 3 there is  = export Japan

at line 3 there is  = export 

 

many other lines don't have the export.

 

Is there a single way to make SAS delete the lines where the word "export" is present in the column"Reason"?


Accepted Solutions
Solution
a week ago
Super Contributor
Posts: 441

Re: Delete line with a similar word

You can do it with a simple Proc SQL command - here's an example using a copy of a SASHELP file which you can adapt for your purposes

 

data cars;
	set sashelp.cars;
run;

proc sql;
	delete from cars where upcase(model) contains "CONVERTIBLE";
quit;

View solution in original post


All Replies
Solution
a week ago
Super Contributor
Posts: 441

Re: Delete line with a similar word

You can do it with a simple Proc SQL command - here's an example using a copy of a SASHELP file which you can adapt for your purposes

 

data cars;
	set sashelp.cars;
run;

proc sql;
	delete from cars where upcase(model) contains "CONVERTIBLE";
quit;
Occasional Contributor
Posts: 14

Re: Delete line with a similar word

Posted in reply to ChrisBrooks

Hi Chris,

 

YOU ARE FANTASTIC!!!!!!!!!!!

THAT WORKED VERY WELL!!!!!!!!!

THANKS, A LOT!!!!!!!!!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 99 views
  • 0 likes
  • 2 in conversation