<?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: converting variable type from character to numeric in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/converting-variable-type-from-character-to-numeric/m-p/212798#M3032</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;create a new variable using the input function.&lt;/P&gt;&lt;P&gt;some examples here: &lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p19en16vskd2vhn1vwmxpxnglxxs.htm" title="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p19en16vskd2vhn1vwmxpxnglxxs.htm"&gt;SAS(R) 9.3 Functions and CALL Routines: Reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Jul 2015 18:57:38 GMT</pubDate>
    <dc:creator>M_Maldonado</dc:creator>
    <dc:date>2015-07-28T18:57:38Z</dc:date>
    <item>
      <title>converting variable type from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/converting-variable-type-from-character-to-numeric/m-p/212797#M3031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I have the following data set and I wonder if someone can tell me the Code to change the ID column from Character to Numeric so that I can do analysis. My problem is I have some value under ID column that are combination of character and numeric (eg. V13), therefore consider the whole column as text.&lt;/P&gt;&lt;P&gt;The analysis code for my analysis is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Have;&lt;/P&gt;&lt;P&gt;set Out;&lt;/P&gt;&lt;P&gt;where ID between 12 and 24;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 128px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" width="64"&gt;Name&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="64"&gt;ID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;A&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;B&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;C&lt;/TD&gt;&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;V13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;D&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2015 18:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/converting-variable-type-from-character-to-numeric/m-p/212797#M3031</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2015-07-28T18:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: converting variable type from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/converting-variable-type-from-character-to-numeric/m-p/212798#M3032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;create a new variable using the input function.&lt;/P&gt;&lt;P&gt;some examples here: &lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p19en16vskd2vhn1vwmxpxnglxxs.htm" title="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#p19en16vskd2vhn1vwmxpxnglxxs.htm"&gt;SAS(R) 9.3 Functions and CALL Routines: Reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2015 18:57:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/converting-variable-type-from-character-to-numeric/m-p/212798#M3032</guid>
      <dc:creator>M_Maldonado</dc:creator>
      <dc:date>2015-07-28T18:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: converting variable type from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/converting-variable-type-from-character-to-numeric/m-p/212799#M3033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where ( input( ID,best6.)) between 12 and 24;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;though if you expect to get V13 in that result you'll need to do more coding to strip off the character bits before conversion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2015 19:56:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/converting-variable-type-from-character-to-numeric/m-p/212799#M3033</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-07-28T19:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: converting variable type from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/converting-variable-type-from-character-to-numeric/m-p/212800#M3034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you need to keep the 13 after the V?&amp;nbsp; If so use the num_id line.&amp;nbsp; If you want to drop anything that has a character use the new_id line.&amp;nbsp; Run this and you'll see what I mean:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards dsd;&lt;/P&gt;&lt;P&gt;input Name$&amp;nbsp;&amp;nbsp;&amp;nbsp; ID$;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;A,12&lt;/P&gt;&lt;P&gt;B,25&lt;/P&gt;&lt;P&gt;C,V13&lt;/P&gt;&lt;P&gt;D,24&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;new_id = input(id,8.);&lt;/P&gt;&lt;P&gt;num_id = input(compress(id,'a','a'),8.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2015 19:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/converting-variable-type-from-character-to-numeric/m-p/212800#M3034</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-07-28T19:59:33Z</dc:date>
    </item>
  </channel>
</rss>

