<?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 Converting data character to numeric, yeah again.... (SAS9.4) in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671529#M23377</link>
    <description>&lt;P&gt;Hi, I've read some posts and watch the tutorial, but I can figure out how to resolver my (pretty simple) problem. My original data are character format $105 (even if there are numbers) and I want to create a new variable where they would be numerics... Can you help me ? I'm confused between the input, the informat and format...&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*changer mon type de colonnes, ce sont toutes des character sauf No_ferme*/
data prx;
set pr;
DIMx=input(DIM, $8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is a print screen of the data and the code.... THANKS!:)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annie_Fréchette_0-1595442588649.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47525i7CB09546C9ADAA4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Annie_Fréchette_0-1595442588649.png" alt="Annie_Fréchette_0-1595442588649.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2020 18:31:46 GMT</pubDate>
    <dc:creator>Annie_Fréchette</dc:creator>
    <dc:date>2020-07-22T18:31:46Z</dc:date>
    <item>
      <title>Converting data character to numeric, yeah again.... (SAS9.4)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671529#M23377</link>
      <description>&lt;P&gt;Hi, I've read some posts and watch the tutorial, but I can figure out how to resolver my (pretty simple) problem. My original data are character format $105 (even if there are numbers) and I want to create a new variable where they would be numerics... Can you help me ? I'm confused between the input, the informat and format...&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*changer mon type de colonnes, ce sont toutes des character sauf No_ferme*/
data prx;
set pr;
DIMx=input(DIM, $8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is a print screen of the data and the code.... THANKS!:)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annie_Fréchette_0-1595442588649.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47525i7CB09546C9ADAA4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Annie_Fréchette_0-1595442588649.png" alt="Annie_Fréchette_0-1595442588649.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 18:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671529#M23377</guid>
      <dc:creator>Annie_Fréchette</dc:creator>
      <dc:date>2020-07-22T18:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Converting data character to numeric, yeah again.... (SAS9.4)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671567#M23380</link>
      <description>The informat means the way you want to read the data. So, you want to input the DIM as numeric, the informat should be "8.". let see DIMx=input(DIM,8.)</description>
      <pubDate>Wed, 22 Jul 2020 19:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671567#M23380</guid>
      <dc:creator>su35</dc:creator>
      <dc:date>2020-07-22T19:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Converting data character to numeric, yeah again.... (SAS9.4)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671575#M23381</link>
      <description>&lt;P&gt;Just change the informat from &lt;STRONG&gt;$8.&lt;/STRONG&gt; to &lt;STRONG&gt;8.&lt;/STRONG&gt;, since the string you're converting is a string of numbers.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data prx;
set pr;
DIMx=input(DIM, 8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jul 2020 19:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671575#M23381</guid>
      <dc:creator>mklangley</dc:creator>
      <dc:date>2020-07-22T19:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Converting data character to numeric, yeah again.... (SAS9.4)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671587#M23382</link>
      <description>&lt;P&gt;Just to take home the primary message in the replies from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223296"&gt;@mklangley&lt;/a&gt; and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/338831"&gt;@su35&lt;/a&gt;:&amp;nbsp; specify informats in an INPUT function reading a character variable exactly as you specify informats in an INPUT statement reading data from a text file with the same content.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, since you would use an informat of 8. reading numerics from the external file, use it in the input function too.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 20:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671587#M23382</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-07-22T20:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Converting data character to numeric, yeah again.... (SAS9.4)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671731#M23385</link>
      <description>&lt;P&gt;You should check why the information is stored in a char-variable, at all. And why its length is 105 chars, as soon as the number has more than 15 digits you will loose precision when converting it to numeric.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 09:41:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671731#M23385</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-07-23T09:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Converting data character to numeric, yeah again.... (SAS9.4)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671800#M23387</link>
      <description>&lt;P&gt;There is no bug with this code&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data prx;
set pr;
DIMx=input(DIM, 8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but my new variable is a "." for every observation....&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annie_Fréchette_0-1595508340284.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47597iDE3400243D00B9E4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Annie_Fréchette_0-1595508340284.png" alt="Annie_Fréchette_0-1595508340284.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 12:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671800#M23387</guid>
      <dc:creator>Annie_Fréchette</dc:creator>
      <dc:date>2020-07-23T12:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Converting data character to numeric, yeah again.... (SAS9.4)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671808#M23388</link>
      <description>&lt;P&gt;Good that it works.&amp;nbsp; A couple of points.&lt;/P&gt;
&lt;P&gt;There is no need to limit your INFORMAT to just 8 characters.&amp;nbsp; The maximum width that particular informat supports is 32 and the INPUT function does not mind if the string being converted is shorter than the informat width.&lt;/P&gt;
&lt;P&gt;If your variable has length 105 are you sure the digits you want to read are not preceded by spaces that would force them beyond the 8th (or 32nd) character in the string?&amp;nbsp; If might reduce risk to use LEFT() function to remove any leading spaces.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DIMx=input(left(DIM), 32.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jul 2020 13:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671808#M23388</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-23T13:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Converting data character to numeric, yeah again.... (SAS9.4)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671810#M23390</link>
      <description>&lt;P&gt;Thanks! With that code, it is working!:)&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 13:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-data-character-to-numeric-yeah-again-SAS9-4/m-p/671810#M23390</guid>
      <dc:creator>Annie_Fréchette</dc:creator>
      <dc:date>2020-07-23T13:14:02Z</dc:date>
    </item>
  </channel>
</rss>

