<?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: Removing leading character from certain values in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Removing-leading-character-from-certain-values/m-p/842397#M36520</link>
    <description>&lt;P&gt;Thank you so much Ballardw,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Was not aware of&amp;nbsp;&lt;SPAN&gt;The =: is a "begins with". Substr&amp;nbsp; (glad I know this now for future reference).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will format my questions better going forward so it is easier to understand.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2022 19:53:04 GMT</pubDate>
    <dc:creator>Chuckles</dc:creator>
    <dc:date>2022-11-03T19:53:04Z</dc:date>
    <item>
      <title>Removing leading character from certain values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Removing-leading-character-from-certain-values/m-p/842375#M36518</link>
      <description>&lt;P&gt;Kinda of stumped with this one so hoping the community can help. In the list of values below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the id starts with '66' (not all id's start with 66) the leading 6 should be removed from the value so the value is only 17 characters long.&amp;nbsp; Not all id's are 17 characters long.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before processing&amp;nbsp;&lt;/P&gt;&lt;P&gt;id,Zip,registered&lt;BR /&gt;660004583468247345,28211,Y&lt;BR /&gt;660015613515135135,45286,Y&lt;BR /&gt;660351531581351551,72458,N&lt;BR /&gt;660044415151535151,106957,Y&lt;BR /&gt;1358153,41763,Y&lt;BR /&gt;10154543,95847,Y&lt;BR /&gt;10071,8547,Y&lt;BR /&gt;1000586,65482,Y&lt;BR /&gt;10442151,54368,N&lt;BR /&gt;8000397,47352,Y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What the end result shoudl look like&lt;/P&gt;&lt;P&gt;id,Zip,registered&lt;BR /&gt;60004583468247345,28211,Y&lt;BR /&gt;60015613515135135,45286,Y&lt;BR /&gt;60351531581351551,72458,N&lt;BR /&gt;60044415151535151,106957,Y&lt;BR /&gt;1358153,41763,Y&lt;BR /&gt;10154543,95847,Y&lt;BR /&gt;10071,8547,Y&lt;BR /&gt;1000586,65482,Y&lt;BR /&gt;10442151,54368,N&lt;BR /&gt;8000397,47352,Y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips on how to write the code for this?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 18:17:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Removing-leading-character-from-certain-values/m-p/842375#M36518</guid>
      <dc:creator>Chuckles</dc:creator>
      <dc:date>2022-11-03T18:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: Removing leading character from certain values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Removing-leading-character-from-certain-values/m-p/842379#M36519</link>
      <description>&lt;P&gt;One way, first creating an actual data set.&lt;/P&gt;
&lt;PRE&gt;data have;
   infile datalines dlm=',';
   input id :$20. Zip :$5. registered :$1.;
datalines;
660004583468247345,28211,Y
660015613515135135,45286,Y
660351531581351551,72458,N
660044415151535151,106957,Y
1358153,41763,Y
10154543,95847,Y
10071,8547,Y
1000586,65482,Y
10442151,54368,N
8000397,47352,Y
;

data want;
  set have;
  if id=:'66' then id=substr(id,2);
run;&lt;/PRE&gt;
&lt;P&gt;The =: is a "begins with". Substr says to start at the second character to length of the value and keep that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note the data step is the best way to share data. That way we do not have to make guesses as to variable types.&lt;/P&gt;
&lt;P&gt;You really did not need to include other variables if they are not involved in the problem.&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/436455"&gt;@Chuckles&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Kinda of stumped with this one so hoping the community can help. In the list of values below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the id starts with '66' (not all id's start with 66) the leading 6 should be removed from the value so the value is only 17 characters long.&amp;nbsp; Not all id's are 17 characters long.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before processing&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id,Zip,registered&lt;BR /&gt;660004583468247345,28211,Y&lt;BR /&gt;660015613515135135,45286,Y&lt;BR /&gt;660351531581351551,72458,N&lt;BR /&gt;660044415151535151,106957,Y&lt;BR /&gt;1358153,41763,Y&lt;BR /&gt;10154543,95847,Y&lt;BR /&gt;10071,8547,Y&lt;BR /&gt;1000586,65482,Y&lt;BR /&gt;10442151,54368,N&lt;BR /&gt;8000397,47352,Y&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What the end result shoudl look like&lt;/P&gt;
&lt;P&gt;id,Zip,registered&lt;BR /&gt;60004583468247345,28211,Y&lt;BR /&gt;60015613515135135,45286,Y&lt;BR /&gt;60351531581351551,72458,N&lt;BR /&gt;60044415151535151,106957,Y&lt;BR /&gt;1358153,41763,Y&lt;BR /&gt;10154543,95847,Y&lt;BR /&gt;10071,8547,Y&lt;BR /&gt;1000586,65482,Y&lt;BR /&gt;10442151,54368,N&lt;BR /&gt;8000397,47352,Y&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any tips on how to write the code for this?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 18:34:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Removing-leading-character-from-certain-values/m-p/842379#M36519</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-11-03T18:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Removing leading character from certain values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Removing-leading-character-from-certain-values/m-p/842397#M36520</link>
      <description>&lt;P&gt;Thank you so much Ballardw,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Was not aware of&amp;nbsp;&lt;SPAN&gt;The =: is a "begins with". Substr&amp;nbsp; (glad I know this now for future reference).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will format my questions better going forward so it is easier to understand.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 19:53:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Removing-leading-character-from-certain-values/m-p/842397#M36520</guid>
      <dc:creator>Chuckles</dc:creator>
      <dc:date>2022-11-03T19:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Removing leading character from certain values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Removing-leading-character-from-certain-values/m-p/842483#M36524</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   infile datalines dlm=',';
   input id :$20. Zip :$5. registered :$1.;
datalines;
660004583468247345,28211,Y
660015613515135135,45286,Y
660351531581351551,72458,N
660044415151535151,106957,Y
1358153,41763,Y
10154543,95847,Y
10071,8547,Y
1000586,65482,Y
10442151,54368,N
8000397,47352,Y
;

data want;
  set have;
  id=prxchange('s/^6+/6/',1,id);;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Nov 2022 12:05:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Removing-leading-character-from-certain-values/m-p/842483#M36524</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-11-04T12:05:59Z</dc:date>
    </item>
  </channel>
</rss>

