<?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: Reading SQL Server Tables into SAS in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319929#M9188</link>
    <description>&lt;P&gt;All of our tables are small so I won't need to compress, but if I ever come across a larger table and this happens I'll keep it in mind.&amp;nbsp; The main initial problem I have is with printing.&amp;nbsp; There may also be other situations down the road where such a large length size is problematic.&amp;nbsp; So I'll figure out the variable length from the code you gave me and resize when necessary.&amp;nbsp; Thanks.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2016 14:33:14 GMT</pubDate>
    <dc:creator>julicny</dc:creator>
    <dc:date>2016-12-19T14:33:14Z</dc:date>
    <item>
      <title>Reading SQL Server Tables into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319653#M9179</link>
      <description>&lt;P&gt;I have started using SAS/ACCESS for ODBC to read SQL Server tables into SAS as datasets in a Windows PC environment.&amp;nbsp; Some columns come in a length 255 and I was looking for a straightforward way to reduce the lenght to something more reasonable.&amp;nbsp; For instance maybe the maximum bytes a variable actually needs is 25. How do I determine this value and set a length for the variable to accomidate this? Any other general tips on prepping data for use in SAS, given that it is already read in from SQL Server?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 21:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319653#M9179</guid>
      <dc:creator>julicny</dc:creator>
      <dc:date>2016-12-16T21:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SQL Server Tables into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319662#M9180</link>
      <description>&lt;P&gt;What works well for us is to use compression on all tables being read from SQL Server. That way we just let the column lengths default but compression removes all of the blank space so table sizes are still OK. Try both COMPRESS = YES and COMPRESS = BINARY to see what works best for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We actually have COMPRESS = BINARY on permanently for all SAS sessions - I understand this is quite a common practice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to determine the maximum length of a character field:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  select max(length(MyCharColumn)) from MyTable;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Dec 2016 21:16:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319662#M9180</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-12-16T21:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SQL Server Tables into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319663#M9181</link>
      <description>&lt;P&gt;In a data step, use a length statement before the set statement to override the length.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 21:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319663#M9181</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-16T21:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SQL Server Tables into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319679#M9182</link>
      <description>&lt;P&gt;If your database has field sizes of 255 and are only holding 15 characters then it may be time to whip the DBA with wet noodles for laziness.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 21:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319679#M9182</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-16T21:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SQL Server Tables into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319925#M9187</link>
      <description>&lt;P&gt;I will likely need the DBA for future favors so whipping is not an option!&amp;nbsp; I thought that actually SAS might use a default of 255 if there is no information that comes over with the SQL Server table.&amp;nbsp; Thanks to everyone for their answers!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 14:28:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319925#M9187</guid>
      <dc:creator>julicny</dc:creator>
      <dc:date>2016-12-19T14:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SQL Server Tables into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319929#M9188</link>
      <description>&lt;P&gt;All of our tables are small so I won't need to compress, but if I ever come across a larger table and this happens I'll keep it in mind.&amp;nbsp; The main initial problem I have is with printing.&amp;nbsp; There may also be other situations down the road where such a large length size is problematic.&amp;nbsp; So I'll figure out the variable length from the code you gave me and resize when necessary.&amp;nbsp; Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 14:33:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/319929#M9188</guid>
      <dc:creator>julicny</dc:creator>
      <dc:date>2016-12-19T14:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SQL Server Tables into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/323727#M9344</link>
      <description>A former co-worker found a macro referred to as the SQUEEZE macro. That calculated the length of the longest variable and set it to the length. I have not used it but it was very helpful in reducing the size of the datasets.  The place that provided our data set everything to a character variable with the length of 250.</description>
      <pubDate>Tue, 10 Jan 2017 18:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/323727#M9344</guid>
      <dc:creator>Kim_SOM</dc:creator>
      <dc:date>2017-01-10T18:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reading SQL Server Tables into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/323753#M9350</link>
      <description>&lt;P&gt;Thanks for the tip.&amp;nbsp; I have downloaded the macro.&amp;nbsp; The latest version of the macro compresses character as well as numeric variables.&amp;nbsp; My datasets will be small enough that I will not need to compress the numeric variables.&amp;nbsp; It's nice to see that there is an option to compress only character variables...&amp;nbsp; &lt;STRONG&gt;NOCOMPRESS=_numeric_&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 20:05:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Reading-SQL-Server-Tables-into-SAS/m-p/323753#M9350</guid>
      <dc:creator>julicny</dc:creator>
      <dc:date>2017-01-10T20:05:52Z</dc:date>
    </item>
  </channel>
</rss>

