<?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 Modifying the PRXMARCH Function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Modifying-the-PRXMARCH-Function/m-p/858637#M339245</link>
    <description>&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;I aim to create a SAS data set from a PROC HTTP-generated output text file using an IF-THEN DELETE statement. &amp;nbsp;But first, I want to create a PATTERN variable using the PRXMATCH match function using the variable STRING (Please see the code in the DATA step below).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;I desire SAS to return a non-zero value for the PATTERN variable if the STRING contains text like “HC-226, “HC-085A, or “HC-028 provided the STRING value does not contain&lt;STRONG&gt; Replaced &lt;/STRONG&gt;or &lt;STRONG&gt;CD-ROM&lt;/STRONG&gt;.&amp;nbsp; Otherwise, I want SAS to return a zero for the PATTERN variable. &amp;nbsp;However, if the STRING value contains text like &lt;STRONG&gt;Replaced &lt;/STRONG&gt;or &lt;STRONG&gt;CD-ROM&lt;/STRONG&gt;, I want a zero for the PARREN variable.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;My first attempt seems to work if the STRING contains the text like the following:&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;“HC-226, “HC-085A, “HC-028 … and the STRING value does not contain&lt;STRONG&gt; Replaced &lt;/STRONG&gt;or &lt;STRONG&gt;CD-ROM.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier" size="2"&gt;position=prxmatch('m/"HC-\d{3,}/i',string);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;Issue: I don’t know how to modify the above code to get a zero for the PARREN variable if the STRING value contains text like &lt;STRONG&gt;Replaced &lt;/STRONG&gt;or &lt;STRONG&gt;CD-ROM&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;data _null_;
input string $char120.;
position=prxmatch('m/"HC-\d{3,}/i',string); 
put (_ALL_) (=/);
datalines;
&amp;lt;option value="HC-226"&amp;gt;MEPS HC-226: MEPS Panel 23 Three-Year Longitudinal Data File&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-220H"&amp;gt;MEPS HC-220H: 2020 Home Health File&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-093"&amp;gt;HC-093 2006 P10R3/P11R1 Population Characteristics&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-085A"&amp;gt;HC-085A 2004 Prescribed Medicines&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-028"&amp;gt;HC-021 1998 Full Year Population Characteristics (HC-021 replaced by HC-028)&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-014"&amp;gt;HC-014 1996 MEPS HC Survey Data (CD-ROM)&amp;lt;/option&amp;gt; 
&amp;lt;option value="LINK_98HC/IC"&amp;gt;HC-IC Linked Data, 1998&amp;lt;/option&amp;gt; 
;
run;&lt;/PRE&gt;&lt;PRE&gt;434  data _null_;
435  input string $char120.;
436  position=prxmatch('m/"HC-\d{3,}/i',string);
437  put (_ALL_) (=/);
438  datalines;


string=&amp;lt;option value="HC-226"&amp;gt;MEPS HC-226: MEPS Panel 23 Three-Year Longitudinal Data File&amp;lt;/option
&amp;gt;
position=15

string=&amp;lt;option value="HC-220H"&amp;gt;MEPS HC-220H: 2020 Home Health File&amp;lt;/option&amp;gt;
position=15

string=&amp;lt;option value="HC-093"&amp;gt;HC-093 2006 P10R3/P11R1 Population Characteristics&amp;lt;/option&amp;gt;
position=15

string=&amp;lt;option value="HC-085A"&amp;gt;HC-085A 2004 Prescribed Medicines&amp;lt;/option&amp;gt;
position=15

string=&amp;lt;option value="HC-028"&amp;gt;HC-021 1998 Full Year Population Characteristics (HC-021 replaced by
 HC-028)&amp;lt;/option&amp;gt;
position=15

string=&amp;lt;option value="HC-014"&amp;gt;HC-014 1996 MEPS HC Survey Data (CD-ROM)&amp;lt;/option&amp;gt;
position=15

string=&amp;lt;option value="LINK_98HC/IC"&amp;gt;HC-IC Linked Data, 1998&amp;lt;/option&amp;gt;
position=0
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


446  ;
447  run;

&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;Any help will be appreciated.&amp;nbsp; Thanks,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Feb 2023 22:40:53 GMT</pubDate>
    <dc:creator>pkm_edu</dc:creator>
    <dc:date>2023-02-13T22:40:53Z</dc:date>
    <item>
      <title>Modifying the PRXMARCH Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modifying-the-PRXMARCH-Function/m-p/858637#M339245</link>
      <description>&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;I aim to create a SAS data set from a PROC HTTP-generated output text file using an IF-THEN DELETE statement. &amp;nbsp;But first, I want to create a PATTERN variable using the PRXMATCH match function using the variable STRING (Please see the code in the DATA step below).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;I desire SAS to return a non-zero value for the PATTERN variable if the STRING contains text like “HC-226, “HC-085A, or “HC-028 provided the STRING value does not contain&lt;STRONG&gt; Replaced &lt;/STRONG&gt;or &lt;STRONG&gt;CD-ROM&lt;/STRONG&gt;.&amp;nbsp; Otherwise, I want SAS to return a zero for the PATTERN variable. &amp;nbsp;However, if the STRING value contains text like &lt;STRONG&gt;Replaced &lt;/STRONG&gt;or &lt;STRONG&gt;CD-ROM&lt;/STRONG&gt;, I want a zero for the PARREN variable.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;My first attempt seems to work if the STRING contains the text like the following:&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;“HC-226, “HC-085A, “HC-028 … and the STRING value does not contain&lt;STRONG&gt; Replaced &lt;/STRONG&gt;or &lt;STRONG&gt;CD-ROM.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier" size="2"&gt;position=prxmatch('m/"HC-\d{3,}/i',string);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;Issue: I don’t know how to modify the above code to get a zero for the PARREN variable if the STRING value contains text like &lt;STRONG&gt;Replaced &lt;/STRONG&gt;or &lt;STRONG&gt;CD-ROM&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;data _null_;
input string $char120.;
position=prxmatch('m/"HC-\d{3,}/i',string); 
put (_ALL_) (=/);
datalines;
&amp;lt;option value="HC-226"&amp;gt;MEPS HC-226: MEPS Panel 23 Three-Year Longitudinal Data File&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-220H"&amp;gt;MEPS HC-220H: 2020 Home Health File&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-093"&amp;gt;HC-093 2006 P10R3/P11R1 Population Characteristics&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-085A"&amp;gt;HC-085A 2004 Prescribed Medicines&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-028"&amp;gt;HC-021 1998 Full Year Population Characteristics (HC-021 replaced by HC-028)&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-014"&amp;gt;HC-014 1996 MEPS HC Survey Data (CD-ROM)&amp;lt;/option&amp;gt; 
&amp;lt;option value="LINK_98HC/IC"&amp;gt;HC-IC Linked Data, 1998&amp;lt;/option&amp;gt; 
;
run;&lt;/PRE&gt;&lt;PRE&gt;434  data _null_;
435  input string $char120.;
436  position=prxmatch('m/"HC-\d{3,}/i',string);
437  put (_ALL_) (=/);
438  datalines;


string=&amp;lt;option value="HC-226"&amp;gt;MEPS HC-226: MEPS Panel 23 Three-Year Longitudinal Data File&amp;lt;/option
&amp;gt;
position=15

string=&amp;lt;option value="HC-220H"&amp;gt;MEPS HC-220H: 2020 Home Health File&amp;lt;/option&amp;gt;
position=15

string=&amp;lt;option value="HC-093"&amp;gt;HC-093 2006 P10R3/P11R1 Population Characteristics&amp;lt;/option&amp;gt;
position=15

string=&amp;lt;option value="HC-085A"&amp;gt;HC-085A 2004 Prescribed Medicines&amp;lt;/option&amp;gt;
position=15

string=&amp;lt;option value="HC-028"&amp;gt;HC-021 1998 Full Year Population Characteristics (HC-021 replaced by
 HC-028)&amp;lt;/option&amp;gt;
position=15

string=&amp;lt;option value="HC-014"&amp;gt;HC-014 1996 MEPS HC Survey Data (CD-ROM)&amp;lt;/option&amp;gt;
position=15

string=&amp;lt;option value="LINK_98HC/IC"&amp;gt;HC-IC Linked Data, 1998&amp;lt;/option&amp;gt;
position=0
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


446  ;
447  run;

&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;Any help will be appreciated.&amp;nbsp; Thanks,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 22:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modifying-the-PRXMARCH-Function/m-p/858637#M339245</guid>
      <dc:creator>pkm_edu</dc:creator>
      <dc:date>2023-02-13T22:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying the PRXMARCH Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modifying-the-PRXMARCH-Function/m-p/858642#M339248</link>
      <description>&lt;P&gt;Please make your question and description match your code, or vice versa. You repeatedly say PARREN (at maybe PATERN) but there is no variable in the code with that name but it appears you are looking for POSITION.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way is to use an additional function such as FIND to see if your other words are present and then reset the POSITION variable to 0. Default behavior with FIND is it returns the character position number of the target string, such as your "replaced". So if the value is &amp;gt; 0 it was found. The 'i' argument makes the search case insensitive.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
input string $char120.;
position=prxmatch('m/"HC-\d{3,}/i',string); 
if find(string,'replaced','i')&amp;gt;0 or
   find(string,'cd-rom','i')&amp;gt;0 then
   position=0;
put (_ALL_) (=/);
datalines;
&amp;lt;option value="HC-226"&amp;gt;MEPS HC-226: MEPS Panel 23 Three-Year Longitudinal Data File&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-220H"&amp;gt;MEPS HC-220H: 2020 Home Health File&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-093"&amp;gt;HC-093 2006 P10R3/P11R1 Population Characteristics&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-085A"&amp;gt;HC-085A 2004 Prescribed Medicines&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-028"&amp;gt;HC-021 1998 Full Year Population Characteristics (HC-021 replaced by HC-028)&amp;lt;/option&amp;gt; 
&amp;lt;option value="HC-014"&amp;gt;HC-014 1996 MEPS HC Survey Data (CD-ROM)&amp;lt;/option&amp;gt; 
&amp;lt;option value="LINK_98HC/IC"&amp;gt;HC-IC Linked Data, 1998&amp;lt;/option&amp;gt; 
;
run;&lt;/PRE&gt;
&lt;P&gt;There may be a PRX method to accomplish this but not my strong point.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 00:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modifying-the-PRXMARCH-Function/m-p/858642#M339248</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-14T00:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying the PRXMARCH Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modifying-the-PRXMARCH-Function/m-p/858645#M339250</link>
      <description>&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;Hi ballardw (Super User),&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;Thanks for your code.&amp;nbsp; Sorry for the typos.&amp;nbsp; I have corrected PARREN and PATERN as POSITION.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;I aim to create a SAS data set from a PROC HTTP-generated output text file using an IF-THEN DELETE statement. &amp;nbsp;But first, I want to create a POSITION variable using the PRXMATCH&amp;nbsp; function using the variable STRING (Please see the code in the DATA step below).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;I desire SAS to return a non-zero value for the POSITION variable if the STRING contains text like “HC-226, “HC-085A, or “HC-028 provided the STRING value does not contain&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Replaced&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;CD-ROM&lt;/STRONG&gt;.&amp;nbsp; Otherwise, I want SAS to return a zero for the POSITION variable. &amp;nbsp;However, if the STRING value contains text like&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Replaced&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;CD-ROM&lt;/STRONG&gt;, I want a zero for the POSITION variable.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;My first attempt seems to work if the STRING contains the text like the following:&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;“HC-226, “HC-085A, “HC-028 … and the STRING value does not contain&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Replaced&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;CD-ROM.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier" size="2"&gt;position=prxmatch('m/"HC-\d{3,}/i',string);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" size="2"&gt;Issue: I don’t know how to modify the above code to get a zero for the POSITION variable if the STRING value contains text like&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Replaced&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;CD-ROM&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 00:24:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modifying-the-PRXMARCH-Function/m-p/858645#M339250</guid>
      <dc:creator>pkm_edu</dc:creator>
      <dc:date>2023-02-14T00:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying the PRXMARCH Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modifying-the-PRXMARCH-Function/m-p/858647#M339251</link>
      <description>&lt;P&gt;Hi ballardw,&lt;/P&gt;&lt;P&gt;Thank you for revising my code. Your revised code provides me with desired results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data _null_;
input string $char120.;
position=prxmatch('m/"HC-\d{3,}/i',string); 
&lt;STRONG&gt;if find(string,'replaced','i')&amp;gt;0 or
   find(string,'cd-rom','i')&amp;gt;0 then
   position=0;&lt;/STRONG&gt;
put (_ALL_) (=/);
datalines;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 00:45:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modifying-the-PRXMARCH-Function/m-p/858647#M339251</guid>
      <dc:creator>pkm_edu</dc:creator>
      <dc:date>2023-02-14T00:45:22Z</dc:date>
    </item>
  </channel>
</rss>

