<?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: Creating a new variable ID in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439908#M13566</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;letter = byte(64 + your_number);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 24 Feb 2018 04:42:29 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-02-24T04:42:29Z</dc:date>
    <item>
      <title>Creating a new variable ID</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439803#M13556</link>
      <description>&lt;P&gt;Hello SAS Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a new ID sequence to help&amp;nbsp;to identify a current user for when more than one information is introduced for the same "ID_Number".&lt;/P&gt;&lt;P&gt;Bellow are 3 tables and the different information can be found in the column "RealState".&lt;/P&gt;&lt;P&gt;The DataSample1 is the original. In that, the "ID_Number" 5678 has two different entries for "RealState". I would like to manipulate this and have a new information composed by&amp;nbsp;letter helping to differentiate.&lt;/P&gt;&lt;P&gt;The DataSample2 and DataSample3 are what I am looking for. Can be one or other.&lt;/P&gt;&lt;P&gt;In DataSample2 a letter is added to the "ID_NUmber".&amp;nbsp;&lt;/P&gt;&lt;P&gt;In DataSample3 a new column call "sequence" is created with a letter.&lt;/P&gt;&lt;P&gt;In both situation when more than&amp;nbsp;one observation in "RealState"&amp;nbsp; is entered for the same "ID_Number" different letters was applied.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; DataSample1;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;InPUT&lt;/SPAN&gt; ID_Number $ State $ Age RealState $;&lt;/P&gt;&lt;P class="p2"&gt;DATALINES&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;4456 NC 55 House&lt;/P&gt;&lt;P class="p1"&gt;5678 SC 43 House&lt;/P&gt;&lt;P class="p1"&gt;5678 SC 43 Building&lt;/P&gt;&lt;P class="p1"&gt;4321 CA 67 Farm&lt;/P&gt;&lt;P class="p1"&gt;9876 FL 43 Gym&lt;/P&gt;&lt;P class="p1"&gt;;&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; DataSample2;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;InPUT&lt;/SPAN&gt; ID_Number $ State $ Age RealState $;&lt;/P&gt;&lt;P class="p2"&gt;DATALINES&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;4456A NC 55 House&lt;/P&gt;&lt;P class="p1"&gt;5678A SC 43 House&lt;/P&gt;&lt;P class="p1"&gt;5678B SC 43 Building&lt;/P&gt;&lt;P class="p1"&gt;4321A CA 67 Farm&lt;/P&gt;&lt;P class="p1"&gt;9876A FL 43 Gym&lt;/P&gt;&lt;P class="p1"&gt;;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; DataSample3;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;InPUT&lt;/SPAN&gt; ID_Number $ State $ Age RealState $ Sequence $;&lt;/P&gt;&lt;P class="p2"&gt;DATALINES&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;4456 NC 55 House A&lt;/P&gt;&lt;P class="p1"&gt;5678 SC 43 House A&lt;/P&gt;&lt;P class="p1"&gt;5678 SC 43 Building B&lt;/P&gt;&lt;P class="p1"&gt;4321 CA 67 Farm A&lt;/P&gt;&lt;P class="p1"&gt;9876 FL 43 Gym A&lt;/P&gt;&lt;P class="p1"&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 19:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439803#M13556</guid>
      <dc:creator>Giovani</dc:creator>
      <dc:date>2018-02-23T19:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable ID</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439820#M13557</link>
      <description>&lt;P&gt;Will the letter always be the last character? If so, use SUBSTR() to extract it and then use CATX() to append it to the other variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This assumes you're using Base SAS. If you're using Data Management Studio or Data Flux, then it's likely different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And why is BUILDING B? Where does the B come from?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want numbers instead of letters, consider this approach:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can convert the numbers to letters using BYTE() function. 65 to 90 are capital letters corresponding to capital A to Z.&amp;nbsp;&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/170866"&gt;@Giovani&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello SAS Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create a new ID sequence to help&amp;nbsp;to identify a current user for when more than one information is introduced for the same "ID_Number".&lt;/P&gt;
&lt;P&gt;Bellow are 3 tables and the different information can be found in the column "RealState".&lt;/P&gt;
&lt;P&gt;The DataSample1 is the original. In that, the "ID_Number" 5678 has two different entries for "RealState". I would like to manipulate this and have a new information composed by&amp;nbsp;letter helping to differentiate.&lt;/P&gt;
&lt;P&gt;The DataSample2 and DataSample3 are what I am looking for. Can be one or other.&lt;/P&gt;
&lt;P&gt;In DataSample2 a letter is added to the "ID_NUmber".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In DataSample3 a new column call "sequence" is created with a letter.&lt;/P&gt;
&lt;P&gt;In both situation when more than&amp;nbsp;one observation in "RealState"&amp;nbsp; is entered for the same "ID_Number" different letters was applied.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; DataSample1;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;InPUT&lt;/SPAN&gt; ID_Number $ State $ Age RealState $;&lt;/P&gt;
&lt;P class="p2"&gt;DATALINES&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;4456 NC 55 House&lt;/P&gt;
&lt;P class="p1"&gt;5678 SC 43 House&lt;/P&gt;
&lt;P class="p1"&gt;5678 SC 43 Building&lt;/P&gt;
&lt;P class="p1"&gt;4321 CA 67 Farm&lt;/P&gt;
&lt;P class="p1"&gt;9876 FL 43 Gym&lt;/P&gt;
&lt;P class="p1"&gt;;&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; DataSample2;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;InPUT&lt;/SPAN&gt; ID_Number $ State $ Age RealState $;&lt;/P&gt;
&lt;P class="p2"&gt;DATALINES&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;4456A NC 55 House&lt;/P&gt;
&lt;P class="p1"&gt;5678A SC 43 House&lt;/P&gt;
&lt;P class="p1"&gt;5678B SC 43 Building&lt;/P&gt;
&lt;P class="p1"&gt;4321A CA 67 Farm&lt;/P&gt;
&lt;P class="p1"&gt;9876A FL 43 Gym&lt;/P&gt;
&lt;P class="p1"&gt;;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; DataSample3;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;InPUT&lt;/SPAN&gt; ID_Number $ State $ Age RealState $ Sequence $;&lt;/P&gt;
&lt;P class="p2"&gt;DATALINES&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;4456 NC 55 House A&lt;/P&gt;
&lt;P class="p1"&gt;5678 SC 43 House A&lt;/P&gt;
&lt;P class="p1"&gt;5678 SC 43 Building B&lt;/P&gt;
&lt;P class="p1"&gt;4321 CA 67 Farm A&lt;/P&gt;
&lt;P class="p1"&gt;9876 FL 43 Gym A&lt;/P&gt;
&lt;P class="p1"&gt;;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 19:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439820#M13557</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-23T19:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable ID</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439849#M13560</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;Regarding your question:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And why is BUILDING B? Where does the B come from?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;B is the new parameter that I am looking to create&amp;nbsp;as the second "ID" to differentiate&amp;nbsp;the 2 occurrences&amp;nbsp;for "ID_Number" 5678. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I imagine doing this either by including in the letter together with the "ID_Number" (like simulation in DataSample2) or creating a new column(like in DataSample3).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 20:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439849#M13560</guid>
      <dc:creator>Giovani</dc:creator>
      <dc:date>2018-02-23T20:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable ID</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439850#M13561</link>
      <description>&lt;P&gt;Ah, well then the BYTE and enumeration approach I suggested will work.&amp;nbsp;&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/170866"&gt;@Giovani&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;Regarding your question:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And why is BUILDING B? Where does the B come from?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;B is the new parameter that I am looking to create&amp;nbsp;as the second "ID" to differentiate&amp;nbsp;the 2 occurrences&amp;nbsp;for "ID_Number" 5678. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I imagine doing this either by including in the letter together with the "ID_Number" (like simulation in DataSample2) or creating a new column(like in DataSample3).&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 20:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439850#M13561</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-23T20:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable ID</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439854#M13562</link>
      <description>&lt;P&gt;Ok.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help me to build that code?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 20:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439854#M13562</guid>
      <dc:creator>Giovani</dc:creator>
      <dc:date>2018-02-23T20:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable ID</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439859#M13563</link>
      <description>&lt;P&gt;Did you look at the link I included in my first answer? That's&amp;nbsp;about 90% of the solution you want. &amp;nbsp;&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/170866"&gt;@Giovani&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Ok.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please help me to build that code?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 21:01:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439859#M13563</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-23T21:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable ID</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439886#M13564</link>
      <description>&lt;P&gt;Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank very much for the help!&lt;/P&gt;&lt;P&gt;I didn`t get the byte code&amp;nbsp;works, but I made a If&amp;nbsp; then and that worked after the initial codes provided by the site.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 22:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439886#M13564</guid>
      <dc:creator>Giovani</dc:creator>
      <dc:date>2018-02-23T22:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable ID</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439908#M13566</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;letter = byte(64 + your_number);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Feb 2018 04:42:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-new-variable-ID/m-p/439908#M13566</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-24T04:42:29Z</dc:date>
    </item>
  </channel>
</rss>

