<?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 Add suffix based on a column of values in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836310#M36058</link>
    <description>Hi, how can I add suffix to Ids based on a column?&lt;BR /&gt;Suppose to have:&lt;BR /&gt;Id               suffix&lt;BR /&gt;0001              1&lt;BR /&gt;0001              1&lt;BR /&gt;0001              2&lt;BR /&gt;0002              2&lt;BR /&gt;0002              2&lt;BR /&gt;0002              1&lt;BR /&gt;&lt;BR /&gt;Desired output&lt;BR /&gt;Id&lt;BR /&gt;0001_1&lt;BR /&gt;0001_1&lt;BR /&gt;0001_2&lt;BR /&gt;0002_2&lt;BR /&gt;0002_2&lt;BR /&gt;0002_1&lt;BR /&gt;&lt;BR /&gt;Thank you in advance</description>
    <pubDate>Sat, 01 Oct 2022 17:32:26 GMT</pubDate>
    <dc:creator>NewUsrStat</dc:creator>
    <dc:date>2022-10-01T17:32:26Z</dc:date>
    <item>
      <title>Add suffix based on a column of values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836310#M36058</link>
      <description>Hi, how can I add suffix to Ids based on a column?&lt;BR /&gt;Suppose to have:&lt;BR /&gt;Id               suffix&lt;BR /&gt;0001              1&lt;BR /&gt;0001              1&lt;BR /&gt;0001              2&lt;BR /&gt;0002              2&lt;BR /&gt;0002              2&lt;BR /&gt;0002              1&lt;BR /&gt;&lt;BR /&gt;Desired output&lt;BR /&gt;Id&lt;BR /&gt;0001_1&lt;BR /&gt;0001_1&lt;BR /&gt;0001_2&lt;BR /&gt;0002_2&lt;BR /&gt;0002_2&lt;BR /&gt;0002_1&lt;BR /&gt;&lt;BR /&gt;Thank you in advance</description>
      <pubDate>Sat, 01 Oct 2022 17:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836310#M36058</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2022-10-01T17:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add suffix based on a column of values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836325#M36059</link>
      <description>&lt;P&gt;Most probably, you need to define a new variable (because of the length):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have (rename=(id=_id)),
length id $6;
id = catx("_",_id,suffix);
drop _id suffix;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 01 Oct 2022 21:30:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836325#M36059</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-01T21:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Add suffix based on a column of values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836352#M36063</link>
      <description>Thank you dottor bremser. It works perfectly. Only one question: is it possible to convert back the modified ID to numeric?</description>
      <pubDate>Sun, 02 Oct 2022 09:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836352#M36063</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2022-10-02T09:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Add suffix based on a column of values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836358#M36064</link>
      <description>&lt;P&gt;I would not do that. Something that is not used for calculations, but for identification, is better kept as character.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Oct 2022 09:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836358#M36064</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-02T09:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add suffix based on a column of values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836359#M36065</link>
      <description>ok thank you! It is just because there is a piece of code downstream that looks at it as numeric.</description>
      <pubDate>Sun, 02 Oct 2022 10:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Add-suffix-based-on-a-column-of-values/m-p/836359#M36065</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2022-10-02T10:14:42Z</dc:date>
    </item>
  </channel>
</rss>

