<?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 transpose error with same name variable and exceeds 32 length in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-error-with-same-name-variable-and-exceeds-32/m-p/693549#M211497</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19264"&gt;@dennis_oz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Please can you advice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* When I execute the below code it errors , how can I avoid the below error through code . The below data is read externally and I have no control . However , can you suggest something to overcome the above issue programmatically . */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: The ID value "'Anti smoking prdcts Freq Buy Eve'n" occurs twice in the input data set.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data foo;&lt;BR /&gt;infile datalines delimiter=','; &lt;BR /&gt;input F1 $:100. no1 no2 ;&lt;BR /&gt;datalines;&lt;BR /&gt;Anti smoking prdcts Freq Buy Every 2 to 3 months,10,20&lt;BR /&gt;Anti smoking prdcts Freq Buy Every 4 to 6 months,30,40&lt;BR /&gt;Hair loss prev prod Freq Buy Every 2 to 3 months,40,50&lt;BR /&gt;Hair loss prev prod Freq Buy Every 4 to 6 months,60,70&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt; proc transpose data=foo out=foo1; &lt;BR /&gt; id f1;&lt;BR /&gt; run;


&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SAS currently has a hard limit of 32 characters for a variable name. Your values are identical up to the 32d character as that is all SAS can use to make a variable name from an ID in Proc Transpose. ID values cannot be duplicated within a By group, or without at By group, not duplicated at all. So choices are 1) shorten the text 2) move the time period information to within the first 32 characters so it is included in the shortened version that will be created for variable name, 3) us MUCH shorter text and assign a long Label to the created variable, or 4) one of the report options as mentioned by others.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Oct 2020 15:45:29 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-10-22T15:45:29Z</dc:date>
    <item>
      <title>Proc transpose error with same name variable and exceeds 32 length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-error-with-same-name-variable-and-exceeds-32/m-p/693394#M211407</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Please can you advice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* When I execute the below code it errors , how can I avoid the below error through code . The below data is read externally and I have no control . However , can you suggest something to overcome the above issue programmatically . */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: The ID value "'Anti smoking prdcts Freq Buy Eve'n" occurs twice in the input data set.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data foo;&lt;BR /&gt;infile datalines delimiter=','; &lt;BR /&gt;input F1 $:100. no1 no2 ;&lt;BR /&gt;datalines;&lt;BR /&gt;Anti smoking prdcts Freq Buy Every 2 to 3 months,10,20&lt;BR /&gt;Anti smoking prdcts Freq Buy Every 4 to 6 months,30,40&lt;BR /&gt;Hair loss prev prod Freq Buy Every 2 to 3 months,40,50&lt;BR /&gt;Hair loss prev prod Freq Buy Every 4 to 6 months,60,70&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt; proc transpose data=foo out=foo1; &lt;BR /&gt; id f1;&lt;BR /&gt; run;


&lt;/PRE&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>Thu, 22 Oct 2020 07:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-error-with-same-name-variable-and-exceeds-32/m-p/693394#M211407</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2020-10-22T07:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose error with same name variable and exceeds 32 length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-error-with-same-name-variable-and-exceeds-32/m-p/693425#M211425</link>
      <description>&lt;P&gt;That text looks more of a descriptive report header, than something suitable for a column name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question, why are transposing?&lt;/P&gt;
&lt;P&gt;Perhaps you need to create a report, and do the pivoting in PROC REPORT/TABULATE etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, you should clean/transform your data so you get values that are appropriate for columns names. And then use the existing text as label instead in the PROC TRANSPOSE output.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2020 08:15:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-error-with-same-name-variable-and-exceeds-32/m-p/693425#M211425</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2020-10-22T08:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose error with same name variable and exceeds 32 length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-error-with-same-name-variable-and-exceeds-32/m-p/693427#M211427</link>
      <description>&lt;P&gt;Post what you want your desired output to be, as a self-contained SAS datastep using datalines statement, posted using the "Insert SAS code" icon.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2020 08:18:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-error-with-same-name-variable-and-exceeds-32/m-p/693427#M211427</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2020-10-22T08:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc transpose error with same name variable and exceeds 32 length</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-error-with-same-name-variable-and-exceeds-32/m-p/693549#M211497</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19264"&gt;@dennis_oz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Please can you advice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* When I execute the below code it errors , how can I avoid the below error through code . The below data is read externally and I have no control . However , can you suggest something to overcome the above issue programmatically . */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: The ID value "'Anti smoking prdcts Freq Buy Eve'n" occurs twice in the input data set.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data foo;&lt;BR /&gt;infile datalines delimiter=','; &lt;BR /&gt;input F1 $:100. no1 no2 ;&lt;BR /&gt;datalines;&lt;BR /&gt;Anti smoking prdcts Freq Buy Every 2 to 3 months,10,20&lt;BR /&gt;Anti smoking prdcts Freq Buy Every 4 to 6 months,30,40&lt;BR /&gt;Hair loss prev prod Freq Buy Every 2 to 3 months,40,50&lt;BR /&gt;Hair loss prev prod Freq Buy Every 4 to 6 months,60,70&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt; proc transpose data=foo out=foo1; &lt;BR /&gt; id f1;&lt;BR /&gt; run;


&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SAS currently has a hard limit of 32 characters for a variable name. Your values are identical up to the 32d character as that is all SAS can use to make a variable name from an ID in Proc Transpose. ID values cannot be duplicated within a By group, or without at By group, not duplicated at all. So choices are 1) shorten the text 2) move the time period information to within the first 32 characters so it is included in the shortened version that will be created for variable name, 3) us MUCH shorter text and assign a long Label to the created variable, or 4) one of the report options as mentioned by others.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2020 15:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-transpose-error-with-same-name-variable-and-exceeds-32/m-p/693549#M211497</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-22T15:45:29Z</dc:date>
    </item>
  </channel>
</rss>

