<?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: Input not working to convert character to numeric values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458824#M116462</link>
    <description>Thank you so much!!! I knew it was something obvious and simple. This worked! I appreciate your help. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Mon, 30 Apr 2018 20:08:32 GMT</pubDate>
    <dc:creator>PaulaC</dc:creator>
    <dc:date>2018-04-30T20:08:32Z</dc:date>
    <item>
      <title>Input not working to convert character to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458819#M116458</link>
      <description>&lt;P&gt;I have visit numbers that are in character format.&amp;nbsp; I am trying to convert those values to numeric format so they will sort properly (ascending order).&amp;nbsp; The name of my visit number variable is cvisit in analysisallp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the following code, did not get any errors, the new variable got created but did not do the conversion.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data consort1;&lt;BR /&gt;set analysisallp;&lt;BR /&gt;keep usubjid&amp;nbsp;design&amp;nbsp;invarm cvisitn;&lt;BR /&gt;cvisitn=input(cvisit,$2.);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data structure is as follows for consort1:&lt;/P&gt;&lt;P&gt;design usubjid invarm cvisitn (in consort 1 this variable is still character)&lt;/P&gt;&lt;P&gt;DB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The column attributes for cvisitn says&amp;nbsp;$2. for format and informat and the radio button for character is filled in.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I feel like there is something obvious that I am doing wrong, but can't figure out what it is.&amp;nbsp; I am using SAS 9.4 TS level 1M3.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance for your help.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 19:50:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458819#M116458</guid>
      <dc:creator>PaulaC</dc:creator>
      <dc:date>2018-04-30T19:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Input not working to convert character to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458820#M116459</link>
      <description>&lt;P&gt;A $ infornat will create character variables. Use the 2. informat instead.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 19:59:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458820#M116459</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-30T19:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Input not working to convert character to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458824#M116462</link>
      <description>Thank you so much!!! I knew it was something obvious and simple. This worked! I appreciate your help. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 30 Apr 2018 20:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458824#M116462</guid>
      <dc:creator>PaulaC</dc:creator>
      <dc:date>2018-04-30T20:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Input not working to convert character to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458827#M116463</link>
      <description>&lt;P&gt;And if the variable is already character then you need to create a NEW variable to hold the numeric value. Once a variable has a type SAS really doesn't let you change it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cvistnumeric = input(cvistn,f2.);&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 20:09:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458827#M116463</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-30T20:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Input not working to convert character to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458828#M116464</link>
      <description>thank you. So the f will hold the numeric value?</description>
      <pubDate>Mon, 30 Apr 2018 20:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458828#M116464</guid>
      <dc:creator>PaulaC</dc:creator>
      <dc:date>2018-04-30T20:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Input not working to convert character to numeric values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458869#M116477</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/107488"&gt;@PaulaC&lt;/a&gt; wrote:&lt;BR /&gt;thank you. So the f will hold the numeric value?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;F is another way to refer to the w.d informat. It basically says, expect to read two characters into a number and does not expect any decimals, i.e integers from -9 to 99.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I simply don't like not referencing a more explicit format or informat name: 2.&amp;nbsp;&amp;nbsp;or best2. would also work.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 23:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-not-working-to-convert-character-to-numeric-values/m-p/458869#M116477</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-30T23:10:26Z</dc:date>
    </item>
  </channel>
</rss>

