<?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: Transpose procedure in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transpose-procedure/m-p/814060#M321329</link>
    <description>&lt;P&gt;Bad things happen when you attempt to name variables starting with numerals and the SAS list code items don't work with them which makes that a poor choice to try to name things as 1Year 2Year etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This does basically what you want IF you don't try to start the variable name with a numeral.&lt;/P&gt;
&lt;PRE&gt;proc format ;
value d2yr
252='Yr1'
504='Yr2'
756='Yr3'
;

proc transpose data=test2(keep=cusip countdays BHARced)
				out=test3
				name=BHARced;
				id countdays;
				by cusip ;
            format countdays d2yr.;
run;&lt;/PRE&gt;
&lt;P&gt;But really, you should have a very specific reason for a data structure like that and printing or reporting it is not one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 May 2022 13:54:22 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-05-18T13:54:22Z</dc:date>
    <item>
      <title>Transpose procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-procedure/m-p/814035#M321316</link>
      <description>&lt;P&gt;Dear Users,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below I have a code for transpose the from long to wide the BHAR (1year=252 days, 2year=504 etc)&lt;/P&gt;
&lt;P&gt;Is there is a way to do it at the same time for BHR having some kind of macro instead of repeating the procedure again for BHR&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data  test2; 
     set test1; 
     If  countdays=252 or countdays=504 or countdays=756;
run; 

*move the countdays as columns;
proc transpose data=test2(keep=cusip countdays BHARced)
				out=test3
				name=BHARced;
				id countdays;
				by cusip ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have also attached the file.&lt;/P&gt;
&lt;P&gt;Looking forward for&amp;nbsp; your prompt reply&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks in advance&lt;/P&gt;
&lt;P&gt;George&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 11:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-procedure/m-p/814035#M321316</guid>
      <dc:creator>georgel</dc:creator>
      <dc:date>2022-05-18T11:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-procedure/m-p/814041#M321320</link>
      <description>&lt;P&gt;What do you intend to do with the result? If this is some kind of reporting, you are better off with a reporting procedure.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 11:57:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-procedure/m-p/814041#M321320</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-05-18T11:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-procedure/m-p/814060#M321329</link>
      <description>&lt;P&gt;Bad things happen when you attempt to name variables starting with numerals and the SAS list code items don't work with them which makes that a poor choice to try to name things as 1Year 2Year etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This does basically what you want IF you don't try to start the variable name with a numeral.&lt;/P&gt;
&lt;PRE&gt;proc format ;
value d2yr
252='Yr1'
504='Yr2'
756='Yr3'
;

proc transpose data=test2(keep=cusip countdays BHARced)
				out=test3
				name=BHARced;
				id countdays;
				by cusip ;
            format countdays d2yr.;
run;&lt;/PRE&gt;
&lt;P&gt;But really, you should have a very specific reason for a data structure like that and printing or reporting it is not one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 13:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-procedure/m-p/814060#M321329</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-18T13:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-procedure/m-p/814098#M321339</link>
      <description>&lt;P&gt;Dear Kurt,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got a hint from here:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1n2i0ewaj1zian1ria5579z1zjh.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1n2i0ewaj1zian1ria5579z1zjh.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I put the proc transpose inside the loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your prompt reply.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 15:23:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-procedure/m-p/814098#M321339</guid>
      <dc:creator>georgel</dc:creator>
      <dc:date>2022-05-18T15:23:26Z</dc:date>
    </item>
  </channel>
</rss>

