<?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: changing character to a number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445264#M111551</link>
    <description>&lt;P&gt;With some file formats, SAS writes the import code to the log, which you can copy and modify. But not with XLSX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So your easiest option is to convert your variable in a subsequent data step, something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.a_new;
set work.a(rename=(second_tx_start_date = original_second_tx_start_date));
second_tx_start_date = input(original_second_tx_start_date, yymmdd10.);
format second_tx_start_date date.;
drop original_second_tx_start_date;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll need to find the specific informat to use for your date format, the SAS help is the easiest place to look.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
    <pubDate>Tue, 13 Mar 2018 18:25:36 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2018-03-13T18:25:36Z</dc:date>
    <item>
      <title>changing character to a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445254#M111543</link>
      <description>&lt;P&gt;Using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I change an imported date that should be in date format to date format? SAS imported it as a character.&amp;nbsp; Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 17:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445254#M111543</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-03-13T17:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: changing character to a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445256#M111545</link>
      <description>&lt;P&gt;Two options: change the code that imports the date value to use the appropriate informat, or keep importing it as character and use the INPUT function to convert it to a number. If you need more specific information, you'll need to post an example. Tom&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 17:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445256#M111545</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-03-13T17:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: changing character to a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445258#M111547</link>
      <description>&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;import&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;OUT=mylib.a&lt;/P&gt;&lt;P&gt;DATAFILE=&lt;/P&gt;&lt;P&gt;DBMS=xlsx REPLACE;&lt;/P&gt;&lt;P&gt;SHEET= 'sheet3';&lt;/P&gt;&lt;P&gt;GETNAMES=YES;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my import statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the variable is second_tx_start_date, what would an input function look like to convert from character to number?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 18:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445258#M111547</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-03-13T18:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: changing character to a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445264#M111551</link>
      <description>&lt;P&gt;With some file formats, SAS writes the import code to the log, which you can copy and modify. But not with XLSX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So your easiest option is to convert your variable in a subsequent data step, something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.a_new;
set work.a(rename=(second_tx_start_date = original_second_tx_start_date));
second_tx_start_date = input(original_second_tx_start_date, yymmdd10.);
format second_tx_start_date date.;
drop original_second_tx_start_date;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll need to find the specific informat to use for your date format, the SAS help is the easiest place to look.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 18:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445264#M111551</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-03-13T18:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: changing character to a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445265#M111552</link>
      <description>&lt;P&gt;Problem #1: the Excel file format is not usable for a reliable data transfer. See the Gazillion of posts about it here.&lt;/P&gt;
&lt;P&gt;Problem #2: proc import makes guesses, so variable types and other attributes change with the current contents of the infile&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Save your data to a csv file, import that once with proc import, take the resulting data step from the log and adapt it as needed.&lt;/P&gt;
&lt;P&gt;Take control of your process.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 18:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/changing-character-to-a-number/m-p/445265#M111552</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-13T18:30:32Z</dc:date>
    </item>
  </channel>
</rss>

