<?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: Created Table Is HUGE in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132159#M35914</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about telling SAS what you want the string lengths to be :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC SQL;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CONNECT TO ODBC(dsn='SomeDataSource');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CREATE TABLE Data_1 AS&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT col1 length=10, col2 length=10, col3 length=10 &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM CONNECTION TO ODBC(select col1, col2, col3 from SomeTable);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;QUIT;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Jul 2013 18:08:58 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2013-07-11T18:08:58Z</dc:date>
    <item>
      <title>Created Table Is HUGE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132158#M35913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CONNECT TO ODBC(dsn='SomeDataSource');&lt;/P&gt;&lt;P&gt;CREATE TABLE Data_1 AS&lt;/P&gt;&lt;P&gt;SELECT * FROM CONNECTION TO ODBC(select col1, col2, col3 from SomeTable);&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the source DB col1, col2, col3 are all varchar(255)&amp;nbsp; It is MS SQL Server if that matters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is that the size of the created table in SAS is very large relative to the data.&amp;nbsp; More specifically, it looks like the table is creating all columns as char instead of varchar.&amp;nbsp; We do not have any records where the length of the contents of col1, col2, or col3 are the full 255 characters.&amp;nbsp; If I change the SQL portion to convert(varchar(10), col1) the resulting table is much smaller, and no data is lost as these columns are short.&amp;nbsp; I don't have the ability to modify the source DB, and am forced to convert many of the columns to reduce the size of the table.&amp;nbsp; I am able to get it down to under 20 MB instead of over 100 MB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sure I am doing something wrong and that there must be a better way for me to do it but I can't for the life of me figure it out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 17:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132158#M35913</guid>
      <dc:creator>RossW</dc:creator>
      <dc:date>2013-07-11T17:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Created Table Is HUGE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132159#M35914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about telling SAS what you want the string lengths to be :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC SQL;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CONNECT TO ODBC(dsn='SomeDataSource');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CREATE TABLE Data_1 AS&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT col1 length=10, col2 length=10, col3 length=10 &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM CONNECTION TO ODBC(select col1, col2, col3 from SomeTable);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;QUIT;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 18:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132159#M35914</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-07-11T18:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Created Table Is HUGE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132160#M35915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Disclaimer, I am totally new to this and I may be totally out of touch with reality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am hoping there is an easier and more maintainable way.&amp;nbsp; Since I don't have control of source DBs, I don't know when they change and when my defined data types are no longer correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my perfect world, SAS would inspect the data types of the data set and create variable length columns based on that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 18:14:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132160#M35915</guid>
      <dc:creator>RossW</dc:creator>
      <dc:date>2013-07-11T18:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: Created Table Is HUGE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132161#M35916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Internally, SAS supports only two data types: numeric (float, 1 to 8 bytes) and character (fixed length).Upon import, everything is converted to these datatypes.&amp;nbsp; Boolean, date and integer datatypes are numerics with different formats. Other datatypes can be created when exporting, depending on the format associated with columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 18:34:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132161#M35916</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-07-11T18:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Created Table Is HUGE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132162#M35917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the info.&amp;nbsp; I see that SAS is doing the best it can with it... sadly it is very inefficient.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 18:43:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132162#M35917</guid>
      <dc:creator>RossW</dc:creator>
      <dc:date>2013-07-11T18:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Created Table Is HUGE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132163#M35918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also thought that at first but it turns out to be efficient enough for most purposes. Look at the COMPRESS= dataset option if you need to save space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 20:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132163#M35918</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-07-11T20:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Created Table Is HUGE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132164#M35919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this situation, as PGStats has already mentioned, suggest you set OPTIONS COMPRESS = BINARY; prior to importing all of your tables via ODBC. Using this we compact most of the database tables we import by 80% or more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact we maintain OPTIONS COMPRESS = BINARY; as our session default so that all downstream datasets are similary compressed and this enhances runtime performance as well as saving space.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 20:15:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132164#M35919</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2013-07-11T20:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Created Table Is HUGE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132165#M35920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In some circumstances it may be more efficient to define your dataset as a view (&lt;STRONG&gt;CREATE VIEW Data_1 AS...) &lt;/STRONG&gt;that will take no space at all but will access your database every time you use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 20:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132165#M35920</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-07-11T20:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Created Table Is HUGE</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132166#M35921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome feedback and suggestions everyone!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really appreciate the advice.&amp;nbsp; I am going to try both views and compression and see which works best for us.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 12:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Created-Table-Is-HUGE/m-p/132166#M35921</guid>
      <dc:creator>RossW</dc:creator>
      <dc:date>2013-07-12T12:30:31Z</dc:date>
    </item>
  </channel>
</rss>

