<?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: how to extract differ order using substring fuction or other using other fuctions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-differ-order-using-substring-fuction-or-other/m-p/837162#M331010</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/65449"&gt;@vallsas&lt;/a&gt;,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/65449"&gt;@vallsas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;... would like to extract first 3 parts. by using substring it is not possible ...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why not?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input have :$30.;
want=substr(have,1,findc(have,'.','b')-1);
cards;
12.2.3.4
12.33.44.55
122.333.333.55
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or, if the number of "parts" varies:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(drop=pos len);
input have :$30.;
call scan(have,3,pos,len);
want=substr(have,1,pos+len-1);
cards;
12.2.3.4.5
12.33.44.55.66.77
122.333.333.55.6.77.888.9
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Oct 2022 11:14:06 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2022-10-06T11:14:06Z</dc:date>
    <item>
      <title>how to extract differ order using substring fuction or other using other fuctions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-differ-order-using-substring-fuction-or-other/m-p/837156#M331005</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;i have 12.2.3.4&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12.33.44.55&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 122.333.333.55&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;variable having data like above would like to extract first 3 parts. by using substring it is not possible is there any other functions in sas to get result like below&lt;/P&gt;&lt;P&gt;12.2.3&lt;/P&gt;&lt;P&gt;12.33.44&lt;/P&gt;&lt;P&gt;122.333.333&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 10:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-differ-order-using-substring-fuction-or-other/m-p/837156#M331005</guid>
      <dc:creator>vallsas</dc:creator>
      <dc:date>2022-10-06T10:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract differ order using substring fuction or other using other fuctions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-differ-order-using-substring-fuction-or-other/m-p/837161#M331009</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover;
  input string $20.;
  datalines;
12.2.3.4
12.33.44.55
122.333.333.55
12.2
;

data want;
  set have;
  if 0 then string_want=string;
  string_want=catx('.',scan(string,1,'.'),scan(string,2,'.'),scan(string,3,'.'));
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1665054244878.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75956i83B2BEE5758C757F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1665054244878.png" alt="Patrick_0-1665054244878.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 11:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-differ-order-using-substring-fuction-or-other/m-p/837161#M331009</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-10-06T11:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract differ order using substring fuction or other using other fuctions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-differ-order-using-substring-fuction-or-other/m-p/837162#M331010</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/65449"&gt;@vallsas&lt;/a&gt;,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/65449"&gt;@vallsas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;... would like to extract first 3 parts. by using substring it is not possible ...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why not?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input have :$30.;
want=substr(have,1,findc(have,'.','b')-1);
cards;
12.2.3.4
12.33.44.55
122.333.333.55
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or, if the number of "parts" varies:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(drop=pos len);
input have :$30.;
call scan(have,3,pos,len);
want=substr(have,1,pos+len-1);
cards;
12.2.3.4.5
12.33.44.55.66.77
122.333.333.55.6.77.888.9
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 11:14:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-differ-order-using-substring-fuction-or-other/m-p/837162#M331010</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-10-06T11:14:06Z</dc:date>
    </item>
  </channel>
</rss>

