<?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: ID variable with multiple lengths in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ID-variable-with-multiple-lengths/m-p/167915#M32298</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It may be more likely that the original character variable had a leading blank.&amp;nbsp; You can tell by printing some of the offending IDs in Hex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another alternative would be to recode BOTH IDs to be left justified.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Feb 2015 14:48:52 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2015-02-13T14:48:52Z</dc:date>
    <item>
      <title>ID variable with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ID-variable-with-multiple-lengths/m-p/167914#M32297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to join two datasets (using proc sql) on an ID variable. Though the values of the ID variables match to the other dataset, one of the ID variables is numeric and one is character. I tried converting the numeric one to character using ID_char=put(ID, 7.), and that worked, enabling me to join on some of the values of ID. The problem is that there are some other values of ID that are length 6, and those will not join to the other dataset, presumably because SAS added a trailing blank and that doesn't match to the version in the other set which has no blank (I'm guessing).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2015 14:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ID-variable-with-multiple-lengths/m-p/167914#M32297</guid>
      <dc:creator>Walternate</dc:creator>
      <dc:date>2015-02-13T14:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: ID variable with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ID-variable-with-multiple-lengths/m-p/167915#M32298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It may be more likely that the original character variable had a leading blank.&amp;nbsp; You can tell by printing some of the offending IDs in Hex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another alternative would be to recode BOTH IDs to be left justified.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2015 14:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ID-variable-with-multiple-lengths/m-p/167915#M32298</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2015-02-13T14:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: ID variable with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ID-variable-with-multiple-lengths/m-p/167916#M32299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where strip(A.ID)=strip(put(B.ID,7.));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming A is the char and B the numeric.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2015 14:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ID-variable-with-multiple-lengths/m-p/167916#M32299</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-13T14:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: ID variable with multiple lengths</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ID-variable-with-multiple-lengths/m-p/167917#M32300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I like CATS() as a function that doesn't care whether its inputs are character or numeric.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data A ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; id=7;&lt;/P&gt;&lt;P&gt;&amp;nbsp; A=1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data B;&lt;/P&gt;&lt;P&gt;&amp;nbsp; id=' 7 ';&lt;/P&gt;&lt;P&gt;&amp;nbsp; B=1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt; select * from A,B where cats(a.id)=cats(b.id) ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2015 15:13:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ID-variable-with-multiple-lengths/m-p/167917#M32300</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-02-13T15:13:11Z</dc:date>
    </item>
  </channel>
</rss>

