<?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: Need ideas to transpose a dataset using minimum coding effort in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160674#M41862</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, the only other thing I can think of is array processing with by groups.&amp;nbsp; So:&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array a{20};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array b{20};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; process result into next available array based on spec for a or b etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last.id then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jun 2014 09:32:11 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2014-06-30T09:32:11Z</dc:date>
    <item>
      <title>Need ideas to transpose a dataset using minimum coding effort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160671#M41859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dataset that contain data related to a particular company in a row, over the period of time, say 20 years. So it has observed values of say 10 variables over period of 20 years.&lt;/P&gt;&lt;P&gt;So Like a1-a20 variables for 20 years data and then say b1-b20 variables for 20 years and so on. Like this there are rows related to n companies.&lt;/P&gt;&lt;P&gt;I want to transpose in such a way that data related to "a" transpose and keeps under "a" for 20 years.then next variable "b" will have 20 years of data transposed and so on. The company say C1 will get repeated 20 times for 20 years of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you have any questions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 08:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160671#M41859</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2014-06-30T08:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need ideas to transpose a dataset using minimum coding effort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160672#M41860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, test data and output would probably clarify somewhat.&amp;nbsp; You want something like:&lt;/P&gt;&lt;P&gt;id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a1 a2 a3...a20 b1 b2...b20 c1..&lt;/P&gt;&lt;P&gt;If so then transpose data for the A variables, then the B variables, then the C variables and merge them together.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 09:12:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160672#M41860</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-06-30T09:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need ideas to transpose a dataset using minimum coding effort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160673#M41861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Transposing all variables using n datasteps for n variables and then merging is quite some time taking task, which I have on my last option. I was looking for any better method.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 09:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160673#M41861</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2014-06-30T09:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need ideas to transpose a dataset using minimum coding effort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160674#M41862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, the only other thing I can think of is array processing with by groups.&amp;nbsp; So:&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array a{20};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array b{20};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; process result into next available array based on spec for a or b etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last.id then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 09:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160674#M41862</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-06-30T09:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Need ideas to transpose a dataset using minimum coding effort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160675#M41863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's a good reference for that.&lt;/P&gt;&lt;P&gt;Example 3 is your situation.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/modules/widetolong_data.htm" title="http://www.ats.ucla.edu/stat/sas/modules/widetolong_data.htm"&gt;SAS Learning Module: Reshaping wide to long using a data step&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 14:39:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160675#M41863</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-30T14:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need ideas to transpose a dataset using minimum coding effort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160676#M41864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not entirely sure if the example you have given reflects the actual state of play in regards to your data or whether it is merely a best case scenario.&amp;nbsp; The following will work if each set of variable follows the convention you have displayed in your example, chiefly that there will always be 20 variables for each grouping A1-20 B1-20 and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL NOPRINT;&lt;/P&gt;&lt;P&gt;SELECT &lt;/P&gt;&lt;P&gt;DISTINCT SUBSTR(NAME,1,1) INTO : OUTVARS SEPARATED BY " "&lt;/P&gt;&lt;P&gt;FROM DICTIONARY.COLUMNS&lt;/P&gt;&lt;P&gt;WHERE UPCASE(MEMNAME) = "HAVE"&lt;/P&gt;&lt;P&gt;AND NAME NOT IN ("COMPANY")&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT &lt;/P&gt;&lt;P&gt;DISTINCT NAME INTO : VARNAMES SEPARATED BY " "&lt;/P&gt;&lt;P&gt;FROM DICTIONARY.COLUMNS&lt;/P&gt;&lt;P&gt;WHERE UPCASE(MEMNAME) = "HAVE"&lt;/P&gt;&lt;P&gt;AND NAME NOT IN ("COMPANY")&lt;/P&gt;&lt;P&gt;ORDER BY NAME&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET DIM1 = %SYSFUNC(LENGTH(%SYSFUNC(COMPRESS(&amp;amp;OUTVARS.))));&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;%LET DIM2 = %EVAL(%SYSFUNC(COUNTW(&amp;amp;VARNAMES.))/&amp;amp;DIM1.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WANT;&lt;/P&gt;&lt;P&gt;RETAIN COMPANY PERIOD;&lt;/P&gt;&lt;P&gt;LENGTH PERIOD $2;&lt;/P&gt;&lt;P&gt;SET HAVE;&lt;/P&gt;&lt;P&gt;ARRAY OUTVARS (&amp;amp;DIM1.) &amp;amp;OUTVARS.;&lt;/P&gt;&lt;P&gt;ARRAY INVARS (&amp;amp;DIM1.,&amp;amp;DIM2.) &amp;amp;VARNAMES.;&lt;/P&gt;&lt;P&gt;DO J = 1 TO &amp;amp;DIM2.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; DO I = 1 TO &amp;amp;DIM1.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUTVARS{I} = INVARS{I,J};&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF I = 1 THEN PERIOD = COMPRESS(VNAME(INVARS{I,J}),'0123456789','K');&lt;/P&gt;&lt;P&gt;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUTPUT;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;KEEP COMPANY PERIOD &amp;amp;OUTVARS.;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 04:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160676#M41864</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2014-07-01T04:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need ideas to transpose a dataset using minimum coding effort</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160677#M41865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the variables are all of the same type (numeric vs character) then just use a two dimensional array.&lt;/P&gt;&lt;P&gt;So if you know the variables are a1-a10, b1-b10, c1-c10 then code like this will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; inx(&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;) a1-a10 b1-b10 c1-c10 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; outx a b c ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; year = &lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt; &lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; var=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt; &lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outx(var) = inx(var,year) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; company year a b c ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 05:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-ideas-to-transpose-a-dataset-using-minimum-coding-effort/m-p/160677#M41865</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-01T05:14:53Z</dc:date>
    </item>
  </channel>
</rss>

