<?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: How to determine max record length in dataset in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73444#M21280</link>
    <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
Something like the (untested) code below might do.&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select length(cats(of _all_)) as rec_length&lt;BR /&gt;
  from &lt;YOUR data="https://communities.sas.com/" set=""&gt;&lt;BR /&gt;
  having max(length(cats(of _all_))) = length(cats(of _all_))&lt;BR /&gt;
/*  having length(cats(of _all_)) &amp;gt; 2000 */&lt;BR /&gt;
;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick&lt;/YOUR&gt;</description>
    <pubDate>Mon, 20 Sep 2010 21:40:25 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2010-09-20T21:40:25Z</dc:date>
    <item>
      <title>How to determine max record length in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73443#M21279</link>
      <description>Hi!  Is there a way to determine the maximum record length of a dataset?  &lt;BR /&gt;
&lt;BR /&gt;
I ask because I am running into an issue where I am exporting a dataset to MS Access 2003 and, with some of the records, the last few variables are dropping.  I think it is due to the total record length being more than ~2000 characters for those records.  I then have to remove some variables and execute the PROC EXPORT again (which works well after removing the variables).</description>
      <pubDate>Mon, 20 Sep 2010 21:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73443#M21279</guid>
      <dc:creator>EVN</dc:creator>
      <dc:date>2010-09-20T21:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine max record length in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73444#M21280</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
Something like the (untested) code below might do.&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select length(cats(of _all_)) as rec_length&lt;BR /&gt;
  from &lt;YOUR data="https://communities.sas.com/" set=""&gt;&lt;BR /&gt;
  having max(length(cats(of _all_))) = length(cats(of _all_))&lt;BR /&gt;
/*  having length(cats(of _all_)) &amp;gt; 2000 */&lt;BR /&gt;
;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick&lt;/YOUR&gt;</description>
      <pubDate>Mon, 20 Sep 2010 21:40:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73444#M21280</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-09-20T21:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine max record length in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73445#M21281</link>
      <description>Admittedly, I'm a newby with SAS so I am not sure how to apply your code. Given the below example, how would I apply your code?  I would anticipate the answer to be 16 (the longest record.  Thanks!&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
input var1 var2 $5-17;&lt;BR /&gt;
datalines;&lt;BR /&gt;
123 abcdef&lt;BR /&gt;
234    babcdefghij&lt;BR /&gt;
3455 abcdefghijff&lt;BR /&gt;
;</description>
      <pubDate>Mon, 20 Sep 2010 22:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73445#M21281</guid>
      <dc:creator>EVN</dc:creator>
      <dc:date>2010-09-20T22:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine max record length in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73446#M21282</link>
      <description>Hi:&lt;BR /&gt;
  That number will be the max length of the number of characters needed for a single observation, but do remember that when the data are stored in a SAS dataset, there is some overhead to how the dataset is organized because of the "header" information that SAS stores. This Tech Support note illustrates the complexity involved when trying to calculate the number of "pages" needed to store the data set on disk.&lt;BR /&gt;
 &lt;A href="http://support.sas.com/kb/24/723.html" target="_blank"&gt;http://support.sas.com/kb/24/723.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 21 Sep 2010 00:37:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73446#M21282</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-09-21T00:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine max record length in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73447#M21283</link>
      <description>I am not sure .The dictionary tables in PROC SQL  have a  variable &lt;BR /&gt;
&lt;B&gt;obslen num label='Observation Length'&lt;/B&gt; which you maybe need.But the record length i got is 24.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sql feedback;&lt;BR /&gt;
 describe table dictionary.tables ;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
input var1 var2 $5-17;&lt;BR /&gt;
datalines;&lt;BR /&gt;
123 abcdef&lt;BR /&gt;
234 babcdefghij&lt;BR /&gt;
3455 abcdefghijff&lt;BR /&gt;
; &lt;BR /&gt;
proc sql;&lt;BR /&gt;
 select memname,obslen&lt;BR /&gt;
  from dictionary.tables&lt;BR /&gt;
   where libname='WORK' and memname='TEST';&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Tue, 21 Sep 2010 04:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-determine-max-record-length-in-dataset/m-p/73447#M21283</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-09-21T04:28:04Z</dc:date>
    </item>
  </channel>
</rss>

