<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to search a variable containing &amp;quot;&amp;gt;&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-search-a-variable-containing-quot-gt-quot/m-p/760465#M240475</link>
    <description>&lt;P&gt;Have you tried the Index function?&amp;nbsp; See example, below.&amp;nbsp; In the example, the "Want" dataset will only have variables that do NOT contain a "&amp;lt;" or a "&amp;gt;".&amp;nbsp; If you had other processing to do on other columns, you wouldn't want to do it quite this way.&amp;nbsp; You'd want to perhaps use a DO - END construct and put the variables affected by a "&amp;lt;" or a "&amp;gt;" inside the DO - END.&amp;nbsp; The way the example is coded, if the variable "x" has a "&amp;lt;" or a "&amp;gt;" in it, then the entire row will be dropped, which may not be what you want if you only want to skip processing on certain columns but want to still process other columns in the same row.&amp;nbsp; This is just an example of how to code the INDEX function for a "&amp;lt;" or a "&amp;gt;".&amp;nbsp; You can customize as suits your needs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA	Have;
	INPUT	x	$;
DATALINES;
x
as
&amp;lt;as
&amp;gt;as
;
RUN;
 
DATA	Want;
	SET	Have;
	IF	NOT	((INDEX(STRIP(x), '&amp;lt;'))
		OR	(INDEX(STRIP(x), '&amp;gt;')));
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Aug 2021 20:41:36 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2021-08-09T20:41:36Z</dc:date>
    <item>
      <title>how to search a variable containing "&gt;"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-search-a-variable-containing-quot-gt-quot/m-p/760464#M240474</link>
      <description>&lt;P&gt;Simple question. How do I filter out values with variables containing: "&amp;gt;" , "&amp;lt;"&amp;nbsp; ?&lt;/P&gt;&lt;P&gt;example data:&lt;/P&gt;&lt;P&gt;x&lt;/P&gt;&lt;P&gt;as&lt;/P&gt;&lt;P&gt;&amp;lt;as&lt;/P&gt;&lt;P&gt;&amp;gt;as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if x (does not contain "&amp;gt;" "&amp;lt;") then y=a;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Aug 2021 20:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-search-a-variable-containing-quot-gt-quot/m-p/760464#M240474</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2021-08-09T20:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to search a variable containing "&gt;"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-search-a-variable-containing-quot-gt-quot/m-p/760465#M240475</link>
      <description>&lt;P&gt;Have you tried the Index function?&amp;nbsp; See example, below.&amp;nbsp; In the example, the "Want" dataset will only have variables that do NOT contain a "&amp;lt;" or a "&amp;gt;".&amp;nbsp; If you had other processing to do on other columns, you wouldn't want to do it quite this way.&amp;nbsp; You'd want to perhaps use a DO - END construct and put the variables affected by a "&amp;lt;" or a "&amp;gt;" inside the DO - END.&amp;nbsp; The way the example is coded, if the variable "x" has a "&amp;lt;" or a "&amp;gt;" in it, then the entire row will be dropped, which may not be what you want if you only want to skip processing on certain columns but want to still process other columns in the same row.&amp;nbsp; This is just an example of how to code the INDEX function for a "&amp;lt;" or a "&amp;gt;".&amp;nbsp; You can customize as suits your needs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA	Have;
	INPUT	x	$;
DATALINES;
x
as
&amp;lt;as
&amp;gt;as
;
RUN;
 
DATA	Want;
	SET	Have;
	IF	NOT	((INDEX(STRIP(x), '&amp;lt;'))
		OR	(INDEX(STRIP(x), '&amp;gt;')));
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Aug 2021 20:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-search-a-variable-containing-quot-gt-quot/m-p/760465#M240475</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-09T20:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to search a variable containing "&gt;"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-search-a-variable-containing-quot-gt-quot/m-p/760632#M240529</link>
      <description>&lt;PRE&gt;DATA	Have;
	INPUT	x	$;
DATALINES;
x
as
&amp;lt;as
&amp;gt;as
;
RUN;
 
DATA	Want;
	SET	Have;
	IF	NOT	findc(x, '&amp;lt;&amp;gt;');
RUN;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Aug 2021 13:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-search-a-variable-containing-quot-gt-quot/m-p/760632#M240529</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-08-10T13:17:41Z</dc:date>
    </item>
  </channel>
</rss>

