<?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: Need to get a recursive character (C#) - C#123456 in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373043#M24302</link>
    <description>&lt;P&gt;That is really hard to follow. Can you please show us what you have and what you need. Thanks for including the SQL that you have already.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jul 2017 16:08:37 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-07-04T16:08:37Z</dc:date>
    <item>
      <title>Need to get a recursive character (C#) - C#123456</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373040#M24301</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to get a recursive character contains (C#) followed by 6 digit integer in the field “Description”, I have used a below code in proc sql, i will be getting the first 8 character with the below code, how can i get the "n"th character which contains "C#" followed by interger. pls refer the example below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;number,&amp;nbsp;&lt;/P&gt;&lt;P&gt;substr(desc,index(desc,"C#"),&lt;STRONG&gt;8&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;from mast&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;substr(desc,index(desc,"C#")+&lt;STRONG&gt;2&lt;/STRONG&gt;,&lt;STRONG&gt;1&lt;/STRONG&gt;) in&amp;nbsp;('1','2','3','4','5','6','7','8','9','0'); &amp;nbsp;//to get C# followed by interger only.&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;desc - column_name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eg : 04-06-2015 20:20:39 - dummy (notes) dummy team._&amp;nbsp;&amp;nbsp; Please reun the process&amp;nbsp;dummy &amp;nbsp;04-07-2015 21:15:32 -._&amp;nbsp; Please reun the process&amp;nbsp;(notes) ABCD&amp;nbsp;are &lt;STRONG&gt;C#123456&lt;/STRONG&gt; and &lt;STRONG&gt;C#654321&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Pls help me on this, thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2017 15:52:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373040#M24301</guid>
      <dc:creator>vivekarun12</dc:creator>
      <dc:date>2017-07-04T15:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get a recursive character (C#) - C#123456</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373043#M24302</link>
      <description>&lt;P&gt;That is really hard to follow. Can you please show us what you have and what you need. Thanks for including the SQL that you have already.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2017 16:08:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373043#M24302</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-04T16:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get a recursive character (C#) - C#123456</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373046#M24303</link>
      <description>&lt;P&gt;Thanks for your reply, i will be getting an output as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Number&lt;/TD&gt;&lt;TD&gt;Desc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;INC142584&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;C#123456&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to get,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Number&lt;/TD&gt;&lt;TD&gt;Desc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;INC142584&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;C#123456 C#654321&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to get the second (C#654321) one as well, there may be multiple C# number in the description, I need to get all the C# number in the field description. Pls assist me, thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2017 16:18:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373046#M24303</guid>
      <dc:creator>vivekarun12</dc:creator>
      <dc:date>2017-07-04T16:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get a recursive character (C#) - C#123456</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373057#M24304</link>
      <description>&lt;P&gt;What do you start with?&lt;/P&gt;
&lt;P&gt;Is it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/108533"&gt;@vivekarun12&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for your reply, i will be getting an output as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the below,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;Number&lt;/TD&gt;
&lt;TD&gt;Desc&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;INC142584&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;C#123456&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2017 17:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373057#M24304</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-04T17:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get a recursive character (C#) - C#123456</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373060#M24305</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/108533"&gt;@vivekarun12&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Eg : 04-06-2015 20:20:39 - dummy (notes) dummy team._&amp;nbsp;&amp;nbsp; Please reun the process&amp;nbsp;dummy &amp;nbsp;04-07-2015 21:15:32 -._&amp;nbsp; Please reun the process&amp;nbsp;(notes) ABCD&amp;nbsp;are &lt;STRONG&gt;C#123456&lt;/STRONG&gt; and &lt;STRONG&gt;C#654321&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think this may be what you're starting with? If so, this is much better done in a data step since you can loop the logic.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend regular expressions, which I suck at, so instead I'll give you a reference to a good paper:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/forum2007/223-2007.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2007/223-2007.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could probably use COUNTW to see how many # are in the text, and then loop that many times and check for the string. But to ensure it meets the pattern is more difficult without using regular expressions.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2017 17:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373060#M24305</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-04T17:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get a recursive character (C#) - C#123456</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373071#M24309</link>
      <description>&lt;P&gt;Your questions will be answered far more acurate if you follow the guidance found by the Post button on new posts:&lt;/P&gt;
&lt;P&gt;Post test data in the form of a datastep&lt;/P&gt;
&lt;P&gt;Post example output required&lt;/P&gt;
&lt;P&gt;Explain any logic between&lt;/P&gt;
&lt;P&gt;Post code if you have it&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At a guess:&lt;/P&gt;
&lt;PRE&gt;data have;
  desc="C#123456 C#789564 C#122256";
run;

data want (drop=i word revword);
  set have;
  length final word revword $2000;
  final="";
  do i=1 to countw(desc," ");
    word=scan(desc,i," ");
    revword=cats("C#",reverse(substr(word,index(word,"#")+1)));
    final=catx(" ",final,word,revword);
  end;
run;&lt;/PRE&gt;
&lt;P&gt;You could of course move the word and revword directly into the final= part, I spit it up to show the process.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2017 18:05:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373071#M24309</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-04T18:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get a recursive character (C#) - C#123456</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373581#M24334</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/108533"&gt;@vivekarun12&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Here a RegEx which should return what you're after for up to 6 digits after a &lt;EM&gt;C#&lt;/EM&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dsd truncover;
input Number:$20.	Desc:$100.;
datalines;
INC142584,C#123456
INC142584,C#123456 xxx C#789 yyy
;
run;

data want;
  set have;
  length desc2 $200;
  desc2=prxchange('s/(c#)(\d)(\d)(\d?)(\d?)(\d?)(\d?)(\d?)/\1\2\3\4\5\6\7 \1\7\6\5\4\3\2/oi',-1,desc);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Jul 2017 10:44:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373581#M24334</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-07-06T10:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get a recursive character (C#) - C#123456</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373861#M24353</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the post, for these datalines “INC142584,C#123456 xxx C#789 yyy” I need only “C#123456 C#789”, I have to ignore all the characters (xxx yyy, etc.,) except C# followed by numbers. I don’t need a reverse string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 09:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373861#M24353</guid>
      <dc:creator>vivekarun12</dc:creator>
      <dc:date>2017-07-07T09:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get a recursive character (C#) - C#123456</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373873#M24354</link>
      <description>&lt;P&gt;See this is good example of not clearly stating your question. &amp;nbsp;Posting test data in the form of a datastep - which clearly shows your problem, and what you want at the end is essential to us who cannot guess what you are doing. &amp;nbsp;Now if your problem is a you now describe then a simple datastep:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  length result $2000;
  do i=1 to countw(var1," ");
    if index(scan(var1,i," "),"C#") &amp;gt; 0 then result=catx(' ',want,scan(var1,i," "));
  end;
run;  &lt;/PRE&gt;
&lt;P&gt;This will create a variable result which takes only words from var1 where they contain C#.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 10:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Need-to-get-a-recursive-character-C-C-123456/m-p/373873#M24354</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-07T10:26:39Z</dc:date>
    </item>
  </channel>
</rss>

