<?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 Parsing variable values in PRXPARSE in PERL expressions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Parsing-variable-values-in-PRXPARSE-in-PERL-expressions/m-p/545803#M151064</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I have the below dataset, need to replace the values in target variable with Replace variable. Its working fine with tranwrd , but i am unable to do using PRXCHANGE and PRX parse as i am missing how to PARSE the Target variable values in PRXPARSE&lt;/P&gt;
&lt;TABLE width="648"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="227"&gt;Source&lt;/TD&gt;
&lt;TD width="103"&gt;target&amp;nbsp;&lt;/TD&gt;
&lt;TD width="93"&gt;replace&lt;/TD&gt;
&lt;TD width="225"&gt;Output&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Vegetables are apples and oranges&lt;/TD&gt;
&lt;TD&gt;vegetables&lt;/TD&gt;
&lt;TD&gt;Fruits&lt;/TD&gt;
&lt;TD&gt;Fruits are apples and oranges&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Sugars are Fruct and Fructose&lt;/TD&gt;
&lt;TD&gt;fruct&lt;/TD&gt;
&lt;TD&gt;GLUC&lt;/TD&gt;
&lt;TD&gt;Sugars are GLUC and Fructose&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Labtest and Labtestcd are same&lt;/TD&gt;
&lt;TD&gt;Labtestcd&lt;/TD&gt;
&lt;TD&gt;Lab.Labtestcd&lt;/TD&gt;
&lt;TD&gt;Labtest and lab.labtestcd are same&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data aa;&lt;BR /&gt;set abc;&lt;BR /&gt;new=tranwrd(source,target,replacement) ;&lt;BR /&gt;neew = PrxChange('s/\b(Vegetables)\b/Fruits/i' , -1 , strip(source));;&lt;BR /&gt;run ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the above example i am replacing fruits with vegetables, but i am having huge dataset and i have to replace all the target variable with replace variable. Target variable can consists of&amp;nbsp; combination of letters , numbers and special characters , but i have to replace them with replace variable. How do i parse the TARGET variable values to use them in PRXCHANGE .&lt;/P&gt;
&lt;P&gt;Any sample code with little explanation on how to use PRXPARSE and PRXCHANGE replace in dataset. Individually it can be done , but with different combinations its causing issue.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Mar 2019 13:36:18 GMT</pubDate>
    <dc:creator>keen_sas</dc:creator>
    <dc:date>2019-03-25T13:36:18Z</dc:date>
    <item>
      <title>Parsing variable values in PRXPARSE in PERL expressions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parsing-variable-values-in-PRXPARSE-in-PERL-expressions/m-p/545803#M151064</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I have the below dataset, need to replace the values in target variable with Replace variable. Its working fine with tranwrd , but i am unable to do using PRXCHANGE and PRX parse as i am missing how to PARSE the Target variable values in PRXPARSE&lt;/P&gt;
&lt;TABLE width="648"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="227"&gt;Source&lt;/TD&gt;
&lt;TD width="103"&gt;target&amp;nbsp;&lt;/TD&gt;
&lt;TD width="93"&gt;replace&lt;/TD&gt;
&lt;TD width="225"&gt;Output&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Vegetables are apples and oranges&lt;/TD&gt;
&lt;TD&gt;vegetables&lt;/TD&gt;
&lt;TD&gt;Fruits&lt;/TD&gt;
&lt;TD&gt;Fruits are apples and oranges&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Sugars are Fruct and Fructose&lt;/TD&gt;
&lt;TD&gt;fruct&lt;/TD&gt;
&lt;TD&gt;GLUC&lt;/TD&gt;
&lt;TD&gt;Sugars are GLUC and Fructose&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Labtest and Labtestcd are same&lt;/TD&gt;
&lt;TD&gt;Labtestcd&lt;/TD&gt;
&lt;TD&gt;Lab.Labtestcd&lt;/TD&gt;
&lt;TD&gt;Labtest and lab.labtestcd are same&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data aa;&lt;BR /&gt;set abc;&lt;BR /&gt;new=tranwrd(source,target,replacement) ;&lt;BR /&gt;neew = PrxChange('s/\b(Vegetables)\b/Fruits/i' , -1 , strip(source));;&lt;BR /&gt;run ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the above example i am replacing fruits with vegetables, but i am having huge dataset and i have to replace all the target variable with replace variable. Target variable can consists of&amp;nbsp; combination of letters , numbers and special characters , but i have to replace them with replace variable. How do i parse the TARGET variable values to use them in PRXCHANGE .&lt;/P&gt;
&lt;P&gt;Any sample code with little explanation on how to use PRXPARSE and PRXCHANGE replace in dataset. Individually it can be done , but with different combinations its causing issue.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 13:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parsing-variable-values-in-PRXPARSE-in-PERL-expressions/m-p/545803#M151064</guid>
      <dc:creator>keen_sas</dc:creator>
      <dc:date>2019-03-25T13:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing variable values in PRXPARSE in PERL expressions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parsing-variable-values-in-PRXPARSE-in-PERL-expressions/m-p/545816#M151066</link>
      <description>&lt;P&gt;Unfortunately you have not provided data in usable form, so i can't post tested code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;expression = cats('s/\b(', target, ')\b/', replace, '/i');
neew = prxchange(expression, -1, strip(source));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Mar 2019 13:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parsing-variable-values-in-PRXPARSE-in-PERL-expressions/m-p/545816#M151066</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-03-25T13:54:46Z</dc:date>
    </item>
  </channel>
</rss>

