<?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: DATA FORMAT in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21187#M4454</link>
    <description>You don't give specific information about IMPORT method.  With XL libname engine you can use &lt;BR /&gt;
&lt;BR /&gt;
DBSASTYPE&lt;BR /&gt;
Specifies data types to override the default SAS data types during input processing. &lt;BR /&gt;
&lt;BR /&gt;
Sort of an example.&lt;BR /&gt;
[pre]&lt;BR /&gt;
libname x excel 'book1.xls';&lt;BR /&gt;
data test;&lt;BR /&gt;
   set x.'sheet1$'n(dbsastype=(a='numeric' b='char(2)' c='date'));&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
libname x clear;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Mon, 20 Apr 2009 19:17:13 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2009-04-20T19:17:13Z</dc:date>
    <item>
      <title>DATA FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21185#M4452</link>
      <description>When I import file from EXCEL(XLS), if there exists both missing values and numeric values in a same variable, SAS would read them as a mix variable. So is there anyone know how to transfer this type of format to numeric only? Thanks and Regards.</description>
      <pubDate>Mon, 20 Apr 2009 16:22:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21185#M4452</guid>
      <dc:creator>Fred_Gavin</dc:creator>
      <dc:date>2009-04-20T16:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: DATA FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21186#M4453</link>
      <description>SAS variables are either CHARACTER or NUMERIC in type.  If you need to convert from one format to another, assign a new SAS variable and use the INPUT or PUT function in a DATA step.  Importing with a DATA step provides you more control over how the input data is interpreted, as compared to PROC IMPORT and the SAS-generated program, based on its data interpretation at import time.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 20 Apr 2009 18:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21186#M4453</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-20T18:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: DATA FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21187#M4454</link>
      <description>You don't give specific information about IMPORT method.  With XL libname engine you can use &lt;BR /&gt;
&lt;BR /&gt;
DBSASTYPE&lt;BR /&gt;
Specifies data types to override the default SAS data types during input processing. &lt;BR /&gt;
&lt;BR /&gt;
Sort of an example.&lt;BR /&gt;
[pre]&lt;BR /&gt;
libname x excel 'book1.xls';&lt;BR /&gt;
data test;&lt;BR /&gt;
   set x.'sheet1$'n(dbsastype=(a='numeric' b='char(2)' c='date'));&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
libname x clear;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Mon, 20 Apr 2009 19:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21187#M4454</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-04-20T19:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: DATA FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21188#M4455</link>
      <description>Will the put statement work if you have already imported the file through File&amp;gt;Import? If so, can you give me an example of how to run this? I am having a similar problem when I import an Excel file with alot of missing values, SAS reads the variable as CHAR &amp;amp; i lose the data further down the column.</description>
      <pubDate>Thu, 23 Apr 2009 12:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21188#M4455</guid>
      <dc:creator>Ili</dc:creator>
      <dc:date>2009-04-23T12:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: DATA FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21189#M4456</link>
      <description>For a CHARACTER to NUMERIC conversion, you would use an INPUT function with the appropriate INFORMAT defined in the statement.  Here's the DOC link on SAS.COM support website:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
SAS 9.2 Language Reference: Dictionary - both INPUT function and SAS INFORMATs are discussed in this documentation material:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/titlepage.htm#" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/titlepage.htm#&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 23 Apr 2009 15:17:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21189#M4456</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-23T15:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: DATA FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21190#M4457</link>
      <description>provided by "DATA _NULL_", this most useful example was the only reference to DBSASTYPE in the discussion Forums, so I wanted to add my experience today &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;  - it took some time to appreciate that the column name must be defined in the excel context. &lt;BR /&gt;
The column name in SAS was SBU_code, but using that caused the error message[pre]   ERROR: Invalid column name specified in DBSASTYPE option: SBU_code[/pre]Took me a while to discover that there was no _ in the column name in excel. &lt;BR /&gt;
The working syntax (abbreviated) [pre]data wrking.sasgla_sbu ;&lt;BR /&gt;
    set model2.'SAS_GLA_SBU'n( dbSAStype=( "SBU code"n='char(5)' ) );&lt;BR /&gt;
run ; [/pre]&lt;BR /&gt;
PeterC</description>
      <pubDate>Wed, 12 May 2010 11:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DATA-FORMAT/m-p/21190#M4457</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-05-12T11:32:58Z</dc:date>
    </item>
  </channel>
</rss>

