<?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 order by Fiscal Year in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-order-by-Fiscal-Year/m-p/291402#M60375</link>
    <description>&lt;P&gt;You can use the CONTENTS procedure if you need to find out what the variable names are.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="andale mono,times"&gt;&lt;FONT size="3"&gt;proc&lt;/FONT&gt; &lt;FONT size="3"&gt;contents&lt;/FONT&gt; &lt;FONT size="3"&gt;data&lt;/FONT&gt;&lt;FONT size="3"&gt;=&lt;/FONT&gt;&lt;FONT size="3"&gt;summary12;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="andale mono,times"&gt;&lt;FONT size="3"&gt;&lt;FONT size="3"&gt;&lt;FONT size="3"&gt;run&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="3"&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Aug 2016 19:01:56 GMT</pubDate>
    <dc:creator>RickAster</dc:creator>
    <dc:date>2016-08-12T19:01:56Z</dc:date>
    <item>
      <title>PROC TRANSPOSE order by Fiscal Year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-order-by-Fiscal-Year/m-p/291354#M60370</link>
      <description>&lt;P&gt;Hi...I am trying to transpose a dataset and when I transpose the dataset, the columns which are the corresponding fiscal years are not in the proper order. I am trying to put the dataset in order by a macro variable and I am getting&amp;nbsp;the error message below. I am thinking that it is because of the forward slash "/" that is included in the fiscal year. Any suggestions how I can get around this. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;proc sql&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT color="#0000ff"&gt;select distinct&lt;/FONT&gt;&amp;nbsp;catx(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;' '&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;,FiscalYear) &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT color="#0000ff"&gt;into&lt;/FONT&gt;&amp;nbsp;:List1 separated by &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;','&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT color="#0000ff"&gt;from&lt;/FONT&gt;&amp;nbsp;work.cexdata&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT color="#0000ff"&gt;order by&lt;/FONT&gt;&amp;nbsp;FiscalYear; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;STRONG&gt;&lt;FONT color="#000080"&gt;quit&lt;/FONT&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;STRONG&gt;&lt;FONT color="#000080"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;TOP_10_HC;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT color="#0000ff"&gt;retain&lt;/FONT&gt;&amp;nbsp;PIN PROD1 PROD2 &amp;amp;List1;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT color="#0000ff"&gt;set&lt;/FONT&gt;&amp;nbsp;summary12;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;STRONG&gt;&lt;FONT color="#000080"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LOG OUTPUT:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;130&amp;nbsp;data TOP_10_HC;&lt;/P&gt;
&lt;P&gt;131&amp;nbsp;retain PIN PROD1 PROD2 &amp;amp;List1;&lt;/P&gt;
&lt;P&gt;NOTE: Line generated by the macro variable "LIST1".&lt;/P&gt;
&lt;P&gt;131 2012/13,2013/14,2014/15,2015/16,2016/17&lt;/P&gt;
&lt;P&gt;_&lt;/P&gt;
&lt;P&gt;22&lt;/P&gt;
&lt;P&gt;76&lt;/P&gt;
&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, ;, _ALL_, _CHARACTER_,&lt;/P&gt;
&lt;P&gt;_CHAR_, _NUMERIC_.&lt;/P&gt;
&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;
&lt;P&gt;132&amp;nbsp;set summary12;&lt;/P&gt;
&lt;P&gt;133 run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 17:12:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-order-by-Fiscal-Year/m-p/291354#M60370</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2016-08-12T17:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TRANSPOSE order by Fiscal Year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-order-by-Fiscal-Year/m-p/291360#M60372</link>
      <description>&lt;P&gt;Perhaps sorting the data before the transpose would correct the issue beforehand?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your macro variable does not contain valid SAS variable names.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE: Line generated by the macro variable "LIST1".&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;131 2012/13,2013/14,2014/15,2015/16,2016/17&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that 2012/13 is NOT valid as a variable name because 1)it starts with a digit and 2) contains a /&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 17:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-order-by-Fiscal-Year/m-p/291360#M60372</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-12T17:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TRANSPOSE order by Fiscal Year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-order-by-Fiscal-Year/m-p/291402#M60375</link>
      <description>&lt;P&gt;You can use the CONTENTS procedure if you need to find out what the variable names are.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="andale mono,times"&gt;&lt;FONT size="3"&gt;proc&lt;/FONT&gt; &lt;FONT size="3"&gt;contents&lt;/FONT&gt; &lt;FONT size="3"&gt;data&lt;/FONT&gt;&lt;FONT size="3"&gt;=&lt;/FONT&gt;&lt;FONT size="3"&gt;summary12;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="andale mono,times"&gt;&lt;FONT size="3"&gt;&lt;FONT size="3"&gt;&lt;FONT size="3"&gt;run&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="3"&gt;&lt;FONT size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 19:01:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-order-by-Fiscal-Year/m-p/291402#M60375</guid>
      <dc:creator>RickAster</dc:creator>
      <dc:date>2016-08-12T19:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: PROC TRANSPOSE order by Fiscal Year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-order-by-Fiscal-Year/m-p/291462#M60379</link>
      <description>&lt;P&gt;I guess you mean to do something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
select distinct translate(FiscalYear, "_", "/")
into :List1 separated by ' '
from cexdata
order by FiscalYear;
quit;

proc transpose data=cexdata out=summary12;
by PIN PROD1 PROD2;
var whatever;
id FiscalYear;
run;
 
data TOP_10_HC;
retain PIN PROD1 PROD2 &amp;amp;List1;
set summary12;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 13 Aug 2016 02:18:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-TRANSPOSE-order-by-Fiscal-Year/m-p/291462#M60379</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-08-13T02:18:44Z</dc:date>
    </item>
  </channel>
</rss>

