<?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: Error in rename when variable is a value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364102#M86315</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;: There is a&amp;nbsp;much easier way. Use the PREFIX= option in PROC TRANSPOSE:&lt;/P&gt;&lt;PRE&gt;proc transpose data=ewretdat out=ewretdat2 prefix=PORT;
  by date;
  id momr;
  var ewret;
run;&lt;/PRE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;&lt;SPAN&gt;If you have to run the transpose on a number of datasets where not all momr values will be present each time, here is another way to assign the variable names you want:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data ewretdat;
  input momr ewret date date9.;&lt;BR /&gt;  format date date9.;
  cards;
1 1 01apr2017
2 1 01apr2017
1 2 1may2017
2 2 01may2017
;

proc format;
  value momr
  1=SELL 2=PORT2 3=PORT3 4=PORT4 5=PORT5
  6=PORT6 7=PORT7 8=PORT8 9=PORT9 10=BUY
  ;
run;

proc transpose data=ewretdat out=ewretdat2;
  by date;
  id momr;
  var ewret;
  format momr momr.;   
run;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Art, CEO, AnalystFinder.com&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 04 Jun 2017 07:59:10 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2017-06-04T07:59:10Z</dc:date>
    <item>
      <title>Error in rename when variable is a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364055#M86293</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a novice SAS user and would much appreciate any advice regarding this error:&lt;/P&gt;&lt;DIV class="sasWarning focus-line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasWarning focus-line"&gt;WARNING: The variable _1 in the DROP, KEEP, or RENAME list has never been&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;referenced.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;The error shows up with the code:&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&lt;PRE&gt;proc transpose data=ewretdat out=ewretdat2
(rename = (_1=SELL _2=PORT2 _3=PORT3 _4=PORT4 _5=PORT5
_6=PORT6 _7=PORT7 _8=PORT8 _9=PORT9 _10=BUY));
by date;
id momr;
var ewret;
run;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;The content of the momr column which I am transposing is a simple numerical integer (1 to 10). This issue is preventing me from referencing these new columns to pursue calculations.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;Thanks in advance,&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;Nicolas&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sat, 03 Jun 2017 23:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364055#M86293</guid>
      <dc:creator>nroux</dc:creator>
      <dc:date>2017-06-03T23:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Error in rename when variable is a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364062#M86296</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/147091"&gt;@nroux&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;The warning indicates&amp;nbsp;that&amp;nbsp;Proc Transpose doesn't create a variable _1. May be your variable &lt;EM&gt;momr&amp;nbsp;&lt;/EM&gt;never has a value of 1 in your source data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run your Proc Transpose statement first without the rename and check what variable names you actually get.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Jun 2017 01:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364062#M86296</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-06-04T01:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error in rename when variable is a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364073#M86300</link>
      <description>&lt;P&gt;&lt;SPAN&gt;If you have to run the transpose on a number of datasets where not all momr values will be present each time, here is another way to assign the variable names you want:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data ewretdat;
  input momr ewret date date9.;&lt;BR /&gt;  format date date9.;
  cards;
1 1 01apr2017
2 1 01apr2017
1 2 1may2017
2 2 01may2017
;

proc format;
  value momr
  1=SELL 2=PORT2 3=PORT3 4=PORT4 5=PORT5
  6=PORT6 7=PORT7 8=PORT8 9=PORT9 10=BUY
  ;
run;

proc transpose data=ewretdat out=ewretdat2;
  by date;
  id momr;
  var ewret;
  format momr momr.;   
run;
&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Art, CEO, AnalystFinder.com&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Jun 2017 03:10:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364073#M86300</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-04T03:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: Error in rename when variable is a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364079#M86303</link>
      <description>&lt;P&gt;While the variables won't always exist, you can get rid of the warning pretty easily. &amp;nbsp;Add this to your program:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options dkrocond=nowarn;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That won't add the missing variables, but it will get rid of the warning.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Jun 2017 03:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364079#M86303</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-06-04T03:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error in rename when variable is a value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364102#M86315</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;: There is a&amp;nbsp;much easier way. Use the PREFIX= option in PROC TRANSPOSE:&lt;/P&gt;&lt;PRE&gt;proc transpose data=ewretdat out=ewretdat2 prefix=PORT;
  by date;
  id momr;
  var ewret;
run;&lt;/PRE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;&lt;SPAN&gt;If you have to run the transpose on a number of datasets where not all momr values will be present each time, here is another way to assign the variable names you want:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data ewretdat;
  input momr ewret date date9.;&lt;BR /&gt;  format date date9.;
  cards;
1 1 01apr2017
2 1 01apr2017
1 2 1may2017
2 2 01may2017
;

proc format;
  value momr
  1=SELL 2=PORT2 3=PORT3 4=PORT4 5=PORT5
  6=PORT6 7=PORT7 8=PORT8 9=PORT9 10=BUY
  ;
run;

proc transpose data=ewretdat out=ewretdat2;
  by date;
  id momr;
  var ewret;
  format momr momr.;   
run;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Art, CEO, AnalystFinder.com&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Jun 2017 07:59:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-rename-when-variable-is-a-value/m-p/364102#M86315</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2017-06-04T07:59:10Z</dc:date>
    </item>
  </channel>
</rss>

