<?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: Datastep importing less columns from source table due to variable names over 32 characters in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487202#M71968</link>
    <description>&lt;P&gt;Can you post your full code and the log as well? That's worked any other time I've encountered this issue.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Aug 2018 20:51:20 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-08-15T20:51:20Z</dc:date>
    <item>
      <title>Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487155#M71959</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm encountering a problem due to the 32 character restriction. I'm trying to bring in part of a file from a SQL source system that has some long variable names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the example, there are 3 in particular which bring about this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=source.source_data;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For which I get the following output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Alphabetic List of Variables and Attributes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;#&lt;/TD&gt;&lt;TD&gt;Variable&lt;/TD&gt;&lt;TD&gt;Type&lt;/TD&gt;&lt;TD&gt;Len&lt;/TD&gt;&lt;TD&gt;Format&lt;/TD&gt;&lt;TD&gt;Informat&lt;/TD&gt;&lt;TD&gt;Label&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;MY_VERY_LONG_VARIABLE_NAME_HERE_&lt;/TD&gt;&lt;TD&gt;Char&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;$5.00&lt;/TD&gt;&lt;TD&gt;$5.00&lt;/TD&gt;&lt;TD&gt;MY_VERY_LONG_VARIABLE_NAME_HERE_PART1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;MY_VERY_LONG_VARIABLE_NAME_HERE_&lt;/TD&gt;&lt;TD&gt;Char&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;$5.00&lt;/TD&gt;&lt;TD&gt;$5.00&lt;/TD&gt;&lt;TD&gt;MY_VERY_LONG_VARIABLE_NAME_HERE_PART2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;MY_VERY_LONG_VARIABLE_NAME_HERE_&lt;/TD&gt;&lt;TD&gt;Char&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;$5.00&lt;/TD&gt;&lt;TD&gt;$5.00&lt;/TD&gt;&lt;TD&gt;MY_VERY_LONG_VARIABLE_NAME_HERE_PART3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I ran the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data my_data;
set source.source_data (obs=1000);
run;

proc contents data=my_data;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'd get this output:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Alphabetic List of Variables and Attributes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;#&lt;/TD&gt;&lt;TD&gt;Variable&lt;/TD&gt;&lt;TD&gt;Type&lt;/TD&gt;&lt;TD&gt;Len&lt;/TD&gt;&lt;TD&gt;Format&lt;/TD&gt;&lt;TD&gt;Informat&lt;/TD&gt;&lt;TD&gt;Label&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;MY_VERY_LONG_VARIABLE_NAME_HERE_&lt;/TD&gt;&lt;TD&gt;Char&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;$5.00&lt;/TD&gt;&lt;TD&gt;$5.00&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems like SAS only took in the first of these and didn't bring in the others because they had the same name after truncation to 32 character limit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there anyway to alter the variable names or some other step so I can bring them all in? Something like:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;MY_VERY_LONG_VARIABLE_NAME_HERE1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;MY_VERY_LONG_VARIABLE_NAME_HERE2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;MY_VERY_LONG_VARIABLE_NAME_HERE3&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 19:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487155#M71959</guid>
      <dc:creator>promo_at_work</dc:creator>
      <dc:date>2018-08-15T19:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487175#M71960</link>
      <description>&lt;P&gt;To be honest, I wouldn't fight it in SAS.&amp;nbsp; I would change the variable name in the source file.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 20:15:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487175#M71960</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2018-08-15T20:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487180#M71961</link>
      <description>&lt;P&gt;Did you check the log? I can't believe that SAS did this without some warning.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 20:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487180#M71961</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-08-15T20:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487184#M71962</link>
      <description>&lt;P&gt;The usual workaround is to use SQL Pass Thru and rename in the pass thru query or to create a view in the database with shorter names.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 20:24:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487184#M71962</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-15T20:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487186#M71963</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;No warning whatsoever</description>
      <pubDate>Wed, 15 Aug 2018 20:26:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487186#M71963</guid>
      <dc:creator>promo_at_work</dc:creator>
      <dc:date>2018-08-15T20:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487190#M71964</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried following SQL passthru&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql inobs=10;
connect to db2 (database=BIGSQL user=&amp;amp;user password=&amp;amp;password);
create table my_data( as
select *
from connection to db2 (
     select
     MY_VERY_LONG_VARIABLE_NAME_HERE_PART1 as MY_VERY_LONG_VARIABLE_NAME_HERE1
     MY_VERY_LONG_VARIABLE_NAME_HERE_PART2 as MY_VERY_LONG_VARIABLE_NAME_HERE2
     MY_VERY_LONG_VARIABLE_NAME_HERE_PART3 as MY_VERY_LONG_VARIABLE_NAME_HERE3
     from source.source_data); 
disconnect from db2;
quit;  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But would get error like&lt;/P&gt;&lt;PRE&gt;ERROR 65-58: Name MY_VERY_LONG_VARIABLE_NAME_HERE_PART1 is too long for a SAS name in this context.&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Aug 2018 20:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487190#M71964</guid>
      <dc:creator>promo_at_work</dc:creator>
      <dc:date>2018-08-15T20:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487196#M71965</link>
      <description>&lt;P&gt;Try shorter names like TEST1 to see if it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 20:44:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487196#M71965</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-15T20:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487200#M71966</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;BR /&gt;Tried it out but still getting same error</description>
      <pubDate>Wed, 15 Aug 2018 20:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487200#M71966</guid>
      <dc:creator>promo_at_work</dc:creator>
      <dc:date>2018-08-15T20:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487201#M71967</link>
      <description>&lt;P&gt;Can you post your full code and the log as well? That's worked any other time I've encountered this issue.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 20:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487201#M71967</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-15T20:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487202#M71968</link>
      <description>&lt;P&gt;Can you post your full code and the log as well? That's worked any other time I've encountered this issue.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 20:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487202#M71968</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-15T20:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487203#M71969</link>
      <description>&lt;P&gt;Can you post your full code and the log as well? That's worked any other time I've encountered this issue.....&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226157"&gt;@promo_at_work&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;BR /&gt;Tried it out but still getting same error&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 20:51:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487203#M71969</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-15T20:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487204#M71970</link>
      <description>&lt;P&gt;This problem should be submitted to Technical Support&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/en/technical-support/contact-sas.html" target="_self"&gt;https://support.sas.com/en/technical-support/contact-sas.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2018 20:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487204#M71970</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-08-15T20:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Datastep importing less columns from source table due to variable names over 32 characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487226#M71972</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Managed to get it working with validvarname option in SQL passthrough. Thanks for suggesting that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql inobs=10;
connect to db2 (database=BIGSQL user=&amp;amp;user password=&amp;amp;password validvarname=v7);
create table my_data( as
select *
from connection to db2 (
     select *
from source.source_data); 
disconnect from db2;
quit; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6401"&gt;@HB&lt;/a&gt;: Thanks to both of you for your input.&amp;nbsp;Looks like&amp;nbsp;it's a foregone conclusion that nothing can be done about the variable names unless the change comes from SAS or Data Source (which I don't have direct access to). At least now I have the variables I was trying to bring in and have labels to keep track of them.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 14:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Datastep-importing-less-columns-from-source-table-due-to/m-p/487226#M71972</guid>
      <dc:creator>promo_at_work</dc:creator>
      <dc:date>2018-08-16T14:36:15Z</dc:date>
    </item>
  </channel>
</rss>

