<?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: Proc contents 'Len' in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273078#M54391</link>
    <description>&lt;P&gt;You already did, without needing SQL.&amp;nbsp; Take a look at the output data set from PROC CONTENTS.&amp;nbsp; For example, you could try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=output_contents;&lt;/P&gt;
&lt;P&gt;var name length;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have the information, you just have to figure out how to use it.&lt;/P&gt;</description>
    <pubDate>Wed, 25 May 2016 17:22:46 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-05-25T17:22:46Z</dc:date>
    <item>
      <title>Proc contents 'Len'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273070#M54385</link>
      <description>&lt;P&gt;&amp;nbsp;how to read 'len' from PROC CONTENTS ? I have 368 attributes with diff legth and formats .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried &amp;nbsp;doing PROC CONTENTS &amp;nbsp;and SQL to get the lengths in col_widths.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc contents data = output_xlsd out =output_contents; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc SQL noprint;&lt;BR /&gt;Select len into: col_widths separated by "," From output_contents; Quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting error as 'len; not found as it is not present in the&amp;nbsp;&lt;SPAN&gt;output_contents dataset. How to get the lengths of all attributes with simple logic?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Deepa&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 16:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273070#M54385</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-05-25T16:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc contents 'Len'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273074#M54387</link>
      <description>&lt;P&gt;The relevant variable name in output_contents is LENGTH, not LEN.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 17:16:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273074#M54387</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-25T17:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc contents 'Len'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273076#M54389</link>
      <description>&lt;P&gt;So, are you trying to get the lengths assigned to a new&amp;nbsp;variable (col_widths)?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 17:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273076#M54389</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2016-05-25T17:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc contents 'Len'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273078#M54391</link>
      <description>&lt;P&gt;You already did, without needing SQL.&amp;nbsp; Take a look at the output data set from PROC CONTENTS.&amp;nbsp; For example, you could try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=output_contents;&lt;/P&gt;
&lt;P&gt;var name length;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have the information, you just have to figure out how to use it.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 17:22:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273078#M54391</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-25T17:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Proc contents 'Len'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273144#M54409</link>
      <description>Thanks all</description>
      <pubDate>Wed, 25 May 2016 21:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273144#M54409</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-05-25T21:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc contents 'Len'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273249#M54426</link>
      <description>&lt;P&gt;It would be interesting to know the Why of this. &amp;nbsp;I mean theoretcially you could put all the lengths into macro variables and go that way, but as the SAS metadata can be accessed like a dataset it seems a bit of a faff. &amp;nbsp;Say for instance you want to standardise the length of all character variables to 200 and numerics to 8:&lt;/P&gt;
&lt;PRE&gt;data _null_;&lt;BR /&gt; set sashelp.vcolumn (where=(libname="SASHELP" and memname="CLASS")) end=last;&lt;BR /&gt; if _n_=1 then call execute('data want; length');&lt;BR /&gt; call execute(cat(' ',strip(name),ifc(type="char",' $200',' 8')));&lt;BR /&gt; if last then call execute('; set sashelp.class; run;');&lt;BR /&gt;run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 May 2016 13:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-contents-Len/m-p/273249#M54426</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-26T13:08:05Z</dc:date>
    </item>
  </channel>
</rss>

