<?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 IF prxmatch('/prx-pattern/', catx(' ', of charvar1-charvar100)) vs.  WHERE prxmatch('/prx-pattern/', in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917784#M361530</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got an unexpected error when I tried to run:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WHERE&amp;nbsp;prxmatch('/&lt;SPAN&gt;prx-pattern&lt;/SPAN&gt;/', catx(' ', of charvar1-charvar100))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF prxmatch('/&lt;SPAN&gt;prx-pattern&lt;/SPAN&gt;/', catx(' ', of charvar1-charvar100))&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where no error occurs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I write "charvar1, charvar2, charvar3 ..."&amp;nbsp; instead of&amp;nbsp; "OF&amp;nbsp;charvar1-charvar100" the program is running without errors, but I wonder why this error occurs anyway and how can I sum up the variables like when using the IF statement, so that I don't need to enumerate all 100 variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance,&lt;/P&gt;&lt;P&gt;Curt&lt;/P&gt;</description>
    <pubDate>Sun, 25 Feb 2024 10:44:26 GMT</pubDate>
    <dc:creator>Curt</dc:creator>
    <dc:date>2024-02-25T10:44:26Z</dc:date>
    <item>
      <title>IF prxmatch('/prx-pattern/', catx(' ', of charvar1-charvar100)) vs.  WHERE prxmatch('/prx-pattern/',</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917784#M361530</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got an unexpected error when I tried to run:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WHERE&amp;nbsp;prxmatch('/&lt;SPAN&gt;prx-pattern&lt;/SPAN&gt;/', catx(' ', of charvar1-charvar100))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;instead of&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF prxmatch('/&lt;SPAN&gt;prx-pattern&lt;/SPAN&gt;/', catx(' ', of charvar1-charvar100))&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where no error occurs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I write "charvar1, charvar2, charvar3 ..."&amp;nbsp; instead of&amp;nbsp; "OF&amp;nbsp;charvar1-charvar100" the program is running without errors, but I wonder why this error occurs anyway and how can I sum up the variables like when using the IF statement, so that I don't need to enumerate all 100 variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance,&lt;/P&gt;&lt;P&gt;Curt&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 10:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917784#M361530</guid>
      <dc:creator>Curt</dc:creator>
      <dc:date>2024-02-25T10:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: IF prxmatch('/prx-pattern/', catx(' ', of charvar1-charvar100)) vs.  WHERE prxmatch('/prx-patter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917787#M361531</link>
      <description>&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p1cxl8ifdt8u0gn12wqbji8o5fq1.htm#p08fp02gyb04apn1fmq0a6cu3ynd" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p1cxl8ifdt8u0gn12wqbji8o5fq1.htm#p08fp02gyb04apn1fmq0a6cu3ynd&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/lrcon/9.4/p04fy20d8il3nfn1ssywe4f25k27.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/lrcon/9.4/p04fy20d8il3nfn1ssywe4f25k27.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 10:59:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917787#M361531</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-02-25T10:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: IF prxmatch('/prx-pattern/', catx(' ', of charvar1-charvar100)) vs.  WHERE prxmatch('/prx-patter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917789#M361532</link>
      <description>&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that it would be better to use the IF STATEMENT instead of the WHERE STATEMENT, however, I want to do&amp;nbsp; PROC FREQ&amp;nbsp;&lt;SPAN&gt;where listed variables have one of the listed values. So it is not possible to use&amp;nbsp;the IF STATEMENT instead.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 12:36:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917789#M361532</guid>
      <dc:creator>Curt</dc:creator>
      <dc:date>2024-02-25T12:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: IF prxmatch('/prx-pattern/', catx(' ', of charvar1-charvar100)) vs.  WHERE prxmatch('/prx-patter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917790#M361533</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462130"&gt;@Curt&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are not the first who encounters the fact that the &lt;A href="https://documentation.sas.com/doc/en/lrcon/9.4/n1t04bwpt1jkadn1a5mk35we2yif.htm" target="_blank" rel="noopener"&gt;OF operator&lt;/A&gt; is not available in WHERE statements and WHERE= dataset options (see, e.g., &lt;A href="https://communities.sas.com/t5/SAS-Programming/numeric-character-and-all-in-a-where-dataset-option/m-p/748673/highlight/true#M235146" target="_blank" rel="noopener"&gt;this 2021 thread&lt;/A&gt;). I think the documentation (like the second link provided by &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892" target="_blank" rel="noopener"&gt;PaigeMiller&lt;/A&gt;) should mention this more clearly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case you could create a DATA step &lt;EM&gt;view&lt;/EM&gt;&amp;nbsp;using the IF statement and then apply PROC FREQ to that view.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;data sel &lt;STRONG&gt;/ view=&lt;/STRONG&gt;sel;
set sashelp.us_data;
&lt;STRONG&gt;if&lt;/STRONG&gt; max(&lt;STRONG&gt;of&lt;/STRONG&gt; change:)&amp;gt;20;
run;

proc freq data=&lt;STRONG&gt;sel&lt;/STRONG&gt;;
tables region;
run;&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Feb 2024 13:08:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917790#M361533</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-02-25T13:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: IF prxmatch('/prx-pattern/', catx(' ', of charvar1-charvar100)) vs.  WHERE prxmatch('/prx-patter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917811#M361534</link>
      <description>&lt;P&gt;The "&lt;SPAN&gt;charvar1-charvar100&lt;/SPAN&gt;" is one type of SAS variables lists (to be precise: Numbered Range Lists).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Documentation:&lt;/P&gt;
&lt;P&gt;SAS Variables Lists:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/lrcon/9.4/p0wphcpsfgx6o7n1sjtqzizp1n39.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/lrcon/9.4/p0wphcpsfgx6o7n1sjtqzizp1n39.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;OF operator with SVL:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/lrcon/9.4/n1t04bwpt1jkadn1a5mk35we2yif.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/lrcon/9.4/n1t04bwpt1jkadn1a5mk35we2yif.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS variables list are PDV construct, i.e. they are available _only_ in/for the PDV vector.&lt;/P&gt;
&lt;P&gt;And as the second link provided by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;(&lt;A href="https://documentation.sas.com/doc/en/lrcon/9.4/p04fy20d8il3nfn1ssywe4f25k27.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/lrcon/9.4/p04fy20d8il3nfn1ssywe4f25k27.htm&lt;/A&gt;) says:&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;A WHERE expression tests the condition before an observation is read into the PDV.&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;So, since WHERE works "before" PDV - there is no chance to use PDV's constructs...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 14:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917811#M361534</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-02-25T14:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: IF prxmatch('/prx-pattern/', catx(' ', of charvar1-charvar100)) vs.  WHERE prxmatch('/prx-patter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917835#M361545</link>
      <description>&lt;P&gt;Great suggestion!&lt;/P&gt;&lt;P&gt;Thanks to everyone!&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 21:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-prxmatch-prx-pattern-catx-of-charvar1-charvar100-vs-WHERE/m-p/917835#M361545</guid>
      <dc:creator>Curt</dc:creator>
      <dc:date>2024-02-25T21:20:34Z</dc:date>
    </item>
  </channel>
</rss>

