<?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 drop specific part of the text in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/644936#M19183</link>
    <description>THANK YOU</description>
    <pubDate>Mon, 04 May 2020 09:10:01 GMT</pubDate>
    <dc:creator>PatrykSAS</dc:creator>
    <dc:date>2020-05-04T09:10:01Z</dc:date>
    <item>
      <title>How to drop specific part of the text</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643624#M19166</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;I came across the following problem in the example data:&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="tlid-results-container results-container"&gt;&lt;DIV class="tlid-result result-dict-wrapper"&gt;&lt;DIV class="result tlid-copy-target"&gt;&lt;DIV class="text-wrap tlid-copy-target"&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;ID&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;003&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;0101&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;150&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;00070&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;My case is to get ID without any '0' only at the beginning, so my result should be:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;ID&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;3&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;101&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;150&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;70&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="result-shield-container tlid-copy-target"&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;How can I achieve that?&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;Have a nice day &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Apr 2020 14:52:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643624#M19166</guid>
      <dc:creator>PatrykSAS</dc:creator>
      <dc:date>2020-04-28T14:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop specific part of the text</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643628#M19167</link>
      <description>&lt;P&gt;I would start with something like:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   id = put(input(id,best.),best. -L);
run;
&lt;/PRE&gt;
&lt;P&gt;which may have some dependencies on length of values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next I would examine where the data came from, why it is in an undesired format, and read into SAS as needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, if this is force values to match another NUMERIC value created with a different read/import then you have other issues because this is a Character value.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 14:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643628#M19167</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-28T14:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop specific part of the text</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643630#M19168</link>
      <description>&lt;P&gt;I suppose the ID is defined as char type variable.&lt;/P&gt;
&lt;P&gt;then convert it to numeric by:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have(rename=(ID=_ID);
     id = input(_ID, best5.);
    format ID 5.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Apr 2020 14:55:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643630#M19168</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-04-28T14:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop specific part of the text</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643631#M19169</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/315439"&gt;@PatrykSAS&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0aesccozrvg19n1bg83z1jb9nid.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;VERIFY function&lt;/A&gt; would avoid potential length issues:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id $;
cards;
003
0101
150
00070
;

data want;
set have;
id=substr(id,verify(id,'0'));
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Apr 2020 14:59:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643631#M19169</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-04-28T14:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop specific part of the text</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643680#M19171</link>
      <description>&lt;P&gt;The prxchange function is another possibility for character strings:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
    set have;
    newid = prxchange('s/^(0*)(.*)/$2/', 1, id);
run; 
&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Apr 2020 17:10:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643680#M19171</guid>
      <dc:creator>JackHamilton</dc:creator>
      <dc:date>2020-04-28T17:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop specific part of the text</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643878#M19175</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id $;
cards;
003
0101
150
00070
;

data want;
set have;
new_id=prxchange('s/^0+//',1,id);
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Apr 2020 11:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/643878#M19175</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-04-29T11:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop specific part of the text</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/644936#M19183</link>
      <description>THANK YOU</description>
      <pubDate>Mon, 04 May 2020 09:10:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/644936#M19183</guid>
      <dc:creator>PatrykSAS</dc:creator>
      <dc:date>2020-05-04T09:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop specific part of the text</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/644971#M19184</link>
      <description>&lt;DIV&gt;&lt;STRONG&gt;&lt;FONT style="background-color: #ffffff;"&gt;I know this is already&amp;nbsp; "solved," but wanted to illustrate that there are many ways to solve a data problem with SAS... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT style="background-color: #ffffff;"&gt;/*************/&lt;BR /&gt;/*Anotherway1 "For Grins!" If data "does not" already exist...Create as numeric...*/&lt;BR /&gt;data AnotherWay1;&lt;BR /&gt;input id 8.;&lt;BR /&gt;cards;&lt;BR /&gt;003&lt;BR /&gt;0101&lt;BR /&gt;150&lt;BR /&gt;00070&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;BR /&gt;/*****************/&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT style="background-color: #ffffff;"&gt;/*****************/&lt;BR /&gt;data have;&lt;BR /&gt;input id $;&lt;BR /&gt;cards;&lt;BR /&gt;003&lt;BR /&gt;0101&lt;BR /&gt;150&lt;BR /&gt;00070&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT style="background-color: #ffffff;"&gt;/*Anotherway2 "For Grins!" If "have" already exists...*/&lt;BR /&gt;data AnotherWay2 (drop=id_num);&lt;BR /&gt;length id_num 8.;&lt;BR /&gt;set have;&lt;BR /&gt;id_num=id;&lt;BR /&gt;id=strip(id_num);&amp;nbsp; *&amp;lt;- in case there are padded blanks...;&lt;BR /&gt;run;&lt;BR /&gt;/***************/&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2020 12:57:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-drop-specific-part-of-the-text/m-p/644971#M19184</guid>
      <dc:creator>reprui</dc:creator>
      <dc:date>2020-05-04T12:57:15Z</dc:date>
    </item>
  </channel>
</rss>

