<?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 trim leading characters only in a string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610839#M177960</link>
    <description>&lt;P&gt;Alternatively,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
X= "?????BLAIN_BRUCE?CONOVER_SCOTTD?BEARDWOOD_JOHNP";
do until (scan(x,1,'?','m')^="");
x=substr(x,2);
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 10 Dec 2019 21:18:10 GMT</pubDate>
    <dc:creator>SuryaKiran</dc:creator>
    <dc:date>2019-12-10T21:18:10Z</dc:date>
    <item>
      <title>How to trim leading characters only in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610827#M177950</link>
      <description>&lt;P&gt;Hello, I have a dataset that has multiple names separated by '?' in single column. I was able to separate them but some of them have multiple '?' in front of them. Is there a way I can trim only the first '?' from the character name and not the others?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X=&amp;nbsp;?????BLAIN_BRUCE?CONOVER_SCOTTD?BEARDWOOD_JOHNP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I only want to remove ? from the beginning and not others. so I want the output to look like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BLAIN_BRUCE?CONOVER_SCOTTD?BEARDWOOD_JOHNP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x2=compress(x,'?') ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But this compress removes all ?. I know there is a Btrim function but I would like to use it in data step. Is there anything I can do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 20:57:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610827#M177950</guid>
      <dc:creator>mjizzle</dc:creator>
      <dc:date>2019-12-10T20:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim leading characters only in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610829#M177952</link>
      <description>&lt;P&gt;Try the LEFT function.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 21:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610829#M177952</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-12-10T21:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim leading characters only in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610832#M177954</link>
      <description>&lt;P&gt;Tried it, but doesnt it only work for removing spaces?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 21:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610832#M177954</guid>
      <dc:creator>mjizzle</dc:creator>
      <dc:date>2019-12-10T21:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim leading characters only in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610833#M177955</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/300505"&gt;@mjizzle&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data want;
X="?????BLAIN_BRUCE?CONOVER_SCOTTD?BEARDWOOD_JOHNP";
Want=substr(x,verify(x,'?'));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the above works, though simple as it looks, I owe my sincere gratitude to Guru/Master&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp; for tons of incredibly overwhelming variety of&amp;nbsp; solutions in his SAS-L posts. I recommend reading his posts&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 21:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610833#M177955</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-10T21:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim leading characters only in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610835#M177956</link>
      <description>Perfect!!! It indeed solved my problem. Thank you so much to you and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;</description>
      <pubDate>Tue, 10 Dec 2019 21:10:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610835#M177956</guid>
      <dc:creator>mjizzle</dc:creator>
      <dc:date>2019-12-10T21:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim leading characters only in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610839#M177960</link>
      <description>&lt;P&gt;Alternatively,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
X= "?????BLAIN_BRUCE?CONOVER_SCOTTD?BEARDWOOD_JOHNP";
do until (scan(x,1,'?','m')^="");
x=substr(x,2);
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Dec 2019 21:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610839#M177960</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2019-12-10T21:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to trim leading characters only in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610846#M177964</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;&amp;nbsp; I suppose this problem is rather much too simple and straight forward.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could consider&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Want=substr(x,(notpunct(x)));
Want=substr(x,(anyalnum(x)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and there are many more related approaches so forth.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 21:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-trim-leading-characters-only-in-a-string/m-p/610846#M177964</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-10T21:49:07Z</dc:date>
    </item>
  </channel>
</rss>

