<?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: Cut off part of string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749235#M235390</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    part_of_string = input(scan(var,2,'_'),3.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 21 Jun 2021 11:12:03 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-06-21T11:12:03Z</dc:date>
    <item>
      <title>Cut off part of string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749206#M235381</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;how can I cut off part of sting like in below example:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;VAR&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;USE_01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;USE_12&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;USE_03&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;I want to keep only numbers without "0" -&amp;gt; so result should be 1,12,3&lt;/P&gt;
&lt;P&gt;How can I achieve this?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 09:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749206#M235381</guid>
      <dc:creator>PatrykSAS</dc:creator>
      <dc:date>2021-06-21T09:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Cut off part of string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749230#M235386</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could fix this with a data step and tranwrd. Below you can see an example (with example dataset) that gives the result you want in 2 steps.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.sastest;&lt;BR /&gt;input VAR1 $char6.;&lt;BR /&gt;format VAR1 char6.;&lt;BR /&gt;datalines ;&lt;BR /&gt;USE_01&lt;BR /&gt;USE_12&lt;BR /&gt;USE_03&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data work.sastest2;&lt;BR /&gt;set work.sastest;&lt;BR /&gt;VAR2= tranwrd(VAR1,'USE_','');&lt;BR /&gt;VAR3= tranwrd(VAR2,'0','');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps you!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 10:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749230#M235386</guid>
      <dc:creator>tdswart</dc:creator>
      <dc:date>2021-06-21T10:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Cut off part of string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749231#M235387</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I want to keep only numbers without "0" -&amp;gt; so result should be 1,12,3&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's really hard to generalize from such a small example. So let me ask a few questions&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Are the first four characters always &lt;FONT face="courier new,courier"&gt;USE_&lt;/FONT&gt; or can they be something else?&lt;/LI&gt;
&lt;LI&gt;Is there always an underscore?&lt;/LI&gt;
&lt;LI&gt;What would you do about USE_10, the above statement seems to indicate you don't want it because it has a zero&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 10:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749231#M235387</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-21T10:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Cut off part of string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749234#M235389</link>
      <description>Hi PaigeMiller,&lt;BR /&gt;Yes its always pattern USE_ with underscore&lt;BR /&gt;If its USE_10 I'd keep number 10</description>
      <pubDate>Mon, 21 Jun 2021 11:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749234#M235389</guid>
      <dc:creator>PatrykSAS</dc:creator>
      <dc:date>2021-06-21T11:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: Cut off part of string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749235#M235390</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    part_of_string = input(scan(var,2,'_'),3.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Jun 2021 11:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cut-off-part-of-string/m-p/749235#M235390</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-21T11:12:03Z</dc:date>
    </item>
  </channel>
</rss>

