<?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: Extract characters after a string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802889#M316110</link>
    <description>&lt;P&gt;You didn't say so, but it appears that &lt;EM&gt;&lt;STRONG&gt;viewname&lt;/STRONG&gt;&lt;/EM&gt; always starts with "&lt;STRONG&gt;prod.V_&lt;/STRONG&gt;" followed by &lt;EM&gt;&lt;STRONG&gt;type&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp; followed by an underscore ("&lt;STRONG&gt;_&lt;/STRONG&gt;"), followed by the value for needed.&amp;nbsp; If so, then concatenate "&lt;STRONG&gt;proc.V_&lt;/STRONG&gt;" with &lt;EM&gt;&lt;STRONG&gt;type&lt;/STRONG&gt;&lt;/EM&gt; with an underscore and remove the resulting expression from &lt;EM&gt;&lt;STRONG&gt;viewname&lt;/STRONG&gt;&lt;/EM&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input type :$9.  viewname :$20. ;
datalines;
KIND-03	prod.V_KIND-03_VISDT
KIND-03	prod.V_KIND-03_NT_NI
MIND-03	prod.V_MIND-03_LID
FINDLE-03	prod.V_FINDLE-03_Labrun
run;
data want;
  set have;
  *needed=transtrn(viewname,cats("prod.V_",type),'');  /*Corrected,see next line*/
  needed=transtrn(viewname,cats("prod.V_",type,'_'),'');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Editted note: corrected code above.&lt;/P&gt;</description>
    <pubDate>Sat, 19 Mar 2022 14:39:49 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2022-03-19T14:39:49Z</dc:date>
    <item>
      <title>Extract characters after a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802886#M316108</link>
      <description>&lt;P&gt;Hi Team,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to figure out&amp;nbsp; a way to solve the problem below. I have "Type" and "Viewname" and currently trying to find a way to get the "Needed" column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Type&lt;/TD&gt;&lt;TD&gt;Viewname&lt;/TD&gt;&lt;TD&gt;Needed&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;KIND-03&lt;/TD&gt;&lt;TD&gt;prod.V_KIND-03_VISDT&lt;/TD&gt;&lt;TD&gt;VISDT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;KIND-03&lt;/TD&gt;&lt;TD&gt;prod.V_KIND-03_NT_NI&lt;/TD&gt;&lt;TD&gt;NT_NI&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;MIND-03&lt;/TD&gt;&lt;TD&gt;prod.V_MIND-03_LID&lt;/TD&gt;&lt;TD&gt;LID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;FINDLE-03&lt;/TD&gt;&lt;TD&gt;prod.V_FINDLE-03_Lab&lt;/TD&gt;&lt;TD&gt;Lab&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a pleasant day!!!&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2022 02:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802886#M316108</guid>
      <dc:creator>shasank</dc:creator>
      <dc:date>2022-03-19T02:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extract characters after a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802889#M316110</link>
      <description>&lt;P&gt;You didn't say so, but it appears that &lt;EM&gt;&lt;STRONG&gt;viewname&lt;/STRONG&gt;&lt;/EM&gt; always starts with "&lt;STRONG&gt;prod.V_&lt;/STRONG&gt;" followed by &lt;EM&gt;&lt;STRONG&gt;type&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp; followed by an underscore ("&lt;STRONG&gt;_&lt;/STRONG&gt;"), followed by the value for needed.&amp;nbsp; If so, then concatenate "&lt;STRONG&gt;proc.V_&lt;/STRONG&gt;" with &lt;EM&gt;&lt;STRONG&gt;type&lt;/STRONG&gt;&lt;/EM&gt; with an underscore and remove the resulting expression from &lt;EM&gt;&lt;STRONG&gt;viewname&lt;/STRONG&gt;&lt;/EM&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input type :$9.  viewname :$20. ;
datalines;
KIND-03	prod.V_KIND-03_VISDT
KIND-03	prod.V_KIND-03_NT_NI
MIND-03	prod.V_MIND-03_LID
FINDLE-03	prod.V_FINDLE-03_Labrun
run;
data want;
  set have;
  *needed=transtrn(viewname,cats("prod.V_",type),'');  /*Corrected,see next line*/
  needed=transtrn(viewname,cats("prod.V_",type,'_'),'');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Editted note: corrected code above.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2022 14:39:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802889#M316110</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-03-19T14:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Extract characters after a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802892#M316113</link>
      <description>&lt;P&gt;Or here some alternative syntax to achieve the same.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  needed=substr(viewname,find(viewname,strip(type),'i')+length(type)+1);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Mar 2022 09:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802892#M316113</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-03-19T09:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extract characters after a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802894#M316115</link>
      <description>&lt;P&gt;Could you please state the rules that should be followed to extract this string? You know your data, we don't, so we'd have to guess, guessing is not a good way for us to proceed, and its hard to generalize from these four examples.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2022 09:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802894#M316115</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-19T09:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Extract characters after a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802918#M316127</link>
      <description>Thank you so much!!. This worked too. Very helpful.</description>
      <pubDate>Sat, 19 Mar 2022 16:41:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-characters-after-a-string/m-p/802918#M316127</guid>
      <dc:creator>shasank</dc:creator>
      <dc:date>2022-03-19T16:41:16Z</dc:date>
    </item>
  </channel>
</rss>

