<?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 variables to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474044#M121744</link>
    <description>&lt;P&gt;Sorry, you misunderstand.&amp;nbsp; We need to see the data, i.e. the items read in which are not being converted, e.g.:&lt;/P&gt;
&lt;P&gt;PP1&lt;/P&gt;
&lt;P&gt;123&lt;/P&gt;
&lt;P&gt;456&lt;/P&gt;
&lt;P&gt;789&lt;/P&gt;
&lt;P&gt;4a12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the above, the fourth row will not read in correctly as it is not numeric.&amp;nbsp; Maybe post a couple of rows from your excel file which demonstrates values which don't read correctly.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jun 2018 12:27:31 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-06-28T12:27:31Z</dc:date>
    <item>
      <title>converting variables to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474036#M121739</link>
      <description>&lt;P&gt;Hello - I'm trying to change variables from character to numeric. Interestingly, some of them converted but others did not. Code below. I'm importing from excel and I wonder if it's easier to format the excel spreadsheet or if that formatting is affecting how SAS is reading in the variables. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ABWNum=input(ABW, Best.); drop ABW;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jun 2018 12:07:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474036#M121739</guid>
      <dc:creator>lmyers2</dc:creator>
      <dc:date>2018-06-28T12:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: converting variables to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474038#M121740</link>
      <description>&lt;P&gt;How are we supposed to answer, we cannot see any data?&amp;nbsp; Input will convert those values which can be converted to numeric, others will just be .&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 12:10:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474038#M121740</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-28T12:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: converting variables to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474039#M121741</link>
      <description>&lt;P&gt;Let me clarify that I put the code within a data step.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example where PP1 converted but MAP1 did not in the results. The code to convert is the same for each variable (copied/pasted line-by-line).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;96 PP1 Num 8 BEST. PP1 
97 MAP1 Char 6 $6. $6. MAP1 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jun 2018 12:10:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474039#M121741</guid>
      <dc:creator>lmyers2</dc:creator>
      <dc:date>2018-06-28T12:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: converting variables to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474044#M121744</link>
      <description>&lt;P&gt;Sorry, you misunderstand.&amp;nbsp; We need to see the data, i.e. the items read in which are not being converted, e.g.:&lt;/P&gt;
&lt;P&gt;PP1&lt;/P&gt;
&lt;P&gt;123&lt;/P&gt;
&lt;P&gt;456&lt;/P&gt;
&lt;P&gt;789&lt;/P&gt;
&lt;P&gt;4a12&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the above, the fourth row will not read in correctly as it is not numeric.&amp;nbsp; Maybe post a couple of rows from your excel file which demonstrates values which don't read correctly.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 12:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474044#M121744</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-28T12:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: converting variables to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474046#M121745</link>
      <description>&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;PP1&lt;/TD&gt;&lt;TD&gt;MAP1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;TD&gt;45.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;61&lt;/TD&gt;&lt;TD&gt;67.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;TD&gt;51.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is sample data from excel. It's all numeric so I'm not sure why some are converting while others are not. Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 12:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474046#M121745</guid>
      <dc:creator>lmyers2</dc:creator>
      <dc:date>2018-06-28T12:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: converting variables to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474054#M121748</link>
      <description>&lt;P&gt;Your problem starts with the use of an unreliable file format for transfering data from Excel to SAS.&lt;/P&gt;
&lt;P&gt;Save the data to a csv file, and then write a data step that reads the csv into a SAS dataset, so that you have full control over the data types and the informats used. Note that importing Excel files involves &lt;EM&gt;guessing&lt;/EM&gt; on the part of SAS, and changes in the data will lead to unwanted changes in your dataset structure.&lt;/P&gt;
&lt;P&gt;You can use proc import once on the csv, and then take the resulting data step from the log to modify it according to your needs.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 12:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474054#M121748</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-28T12:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: converting variables to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474057#M121749</link>
      <description>&lt;P&gt;Yes, would really need to see the file.&amp;nbsp; Excel does a good job at hiding files.&amp;nbsp; One thing I can suggest is to save the Excel file to CSV.&amp;nbsp; Then write your datastep import to import the csv file, which is fully under your control.&amp;nbsp; Don't use proc import (apart from maybe to create initial code), as that guesses.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 12:56:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-variables-to-numeric/m-p/474057#M121749</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-28T12:56:13Z</dc:date>
    </item>
  </channel>
</rss>

