<?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: creating a new dataset where duplicate rows in the old set are attached as new columns in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415773#M26729</link>
    <description>Thanks on that case I do I create a computed column that takes the&lt;BR /&gt;difference between two rows providing the label in the first column matches.&lt;BR /&gt;something like&lt;BR /&gt;If A1=a2 then c1-c2 else 0&lt;BR /&gt;I have found it difficult to perform operations between rows so I thought&lt;BR /&gt;expanding will make it easier but I m new sas&lt;BR /&gt;</description>
    <pubDate>Thu, 23 Nov 2017 08:48:43 GMT</pubDate>
    <dc:creator>Rickyboy</dc:creator>
    <dc:date>2017-11-23T08:48:43Z</dc:date>
    <item>
      <title>creating a new dataset where duplicate rows in the old set are attached as new columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415253#M26697</link>
      <description>&lt;P&gt;Hi Guys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it s my first post here&lt;/P&gt;&lt;P&gt;I m a newbie and I m stuck on a problem&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to reshape a dataset so that duplicate rows in the old&amp;nbsp;are moved&amp;nbsp;to a single row with twice the column lengths in the new dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A B C&lt;/P&gt;&lt;P&gt;A D E&amp;nbsp;&lt;/P&gt;&lt;P&gt;F G H&lt;/P&gt;&lt;P&gt;F I J&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; becomes&amp;nbsp;&amp;nbsp;&amp;nbsp; A B C A D E&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F G H F I J&amp;nbsp;&lt;/P&gt;&lt;P&gt;how would I go about it ?&lt;/P&gt;&lt;P&gt;even better is there a way to do this in enterprise guide ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 17:10:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415253#M26697</guid>
      <dc:creator>Rickyboy</dc:creator>
      <dc:date>2017-11-21T17:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new dataset where duplicate rows in the old set are attached as new column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415257#M26698</link>
      <description>&lt;P&gt;Is the first variable the ID - the indication up to which observation to gathr the data ?&lt;/P&gt;
&lt;P&gt;If yes - why to save it &lt;U&gt;twice&lt;/U&gt; on the row ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What would you do if there are 3 or 4 or &lt;U&gt;more&lt;/U&gt; observations for the same ID?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In many cases, sas can deal better and easier with long form, as you have,&lt;/P&gt;
&lt;P&gt;than with the wide form that you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 17:17:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415257#M26698</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-11-21T17:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new dataset where duplicate rows in the old set are attached as new columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415496#M26719</link>
      <description>&lt;P&gt;It is easy for IML code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x1 $ x2 $ x3 $ ;
cards;
A B C
A D E 
F G H
F I J 
;
run;
proc iml;
use have;
read all var _char_ into x;
close;
want=cshape(x,2,0,1);
print want;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Nov 2017 13:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415496#M26719</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-11-22T13:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new dataset where duplicate rows in the old set are attached as new columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415773#M26729</link>
      <description>Thanks on that case I do I create a computed column that takes the&lt;BR /&gt;difference between two rows providing the label in the first column matches.&lt;BR /&gt;something like&lt;BR /&gt;If A1=a2 then c1-c2 else 0&lt;BR /&gt;I have found it difficult to perform operations between rows so I thought&lt;BR /&gt;expanding will make it easier but I m new sas&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Nov 2017 08:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415773#M26729</guid>
      <dc:creator>Rickyboy</dc:creator>
      <dc:date>2017-11-23T08:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new dataset where duplicate rows in the old set are attached as new columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415806#M26732</link>
      <description>&lt;P&gt;Post some sample data and output that would be better to explain your question.&lt;/P&gt;
&lt;P&gt;If you are doing PROC REPORT, I am afraid that you can't do it with PROC REPORT.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2017 12:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415806#M26732</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-11-23T12:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new dataset where duplicate rows in the old set are attached as new columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415976#M26753</link>
      <description>&lt;P&gt;The data I have is something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;USERID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INCOME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATE&lt;/P&gt;&lt;P&gt;Rick&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; march 2015&lt;/P&gt;&lt;P&gt;Rick&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; September 2016&lt;/P&gt;&lt;P&gt;Mario&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; February 2013&lt;/P&gt;&lt;P&gt;Mario&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; June 2015&lt;/P&gt;&lt;P&gt;Mario&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 17.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; August 2017&lt;/P&gt;&lt;P&gt;Frank&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; June 2015&lt;/P&gt;&lt;P&gt;Frank&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; March 2016&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to compute a column that takes 13.000 - 12.000 = 1000 for rick and tells me if possible the amount of time it passed&lt;/P&gt;&lt;P&gt;same for Mario 1000 and 1000 (or 2000)&amp;nbsp;&amp;nbsp; and Frank 5000&amp;nbsp;&amp;nbsp; in 8 months&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is what I m trying to do&lt;/P&gt;&lt;P&gt;that s why I tried to spread the data to add more column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is quite easy in excel but I m stuck on SAS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 10:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415976#M26753</guid>
      <dc:creator>Rickyboy</dc:creator>
      <dc:date>2017-11-24T10:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new dataset where duplicate rows in the old set are attached as new columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415983#M26755</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Assuming the data is sorted by USERID&amp;nbsp; and date is a sas numeric date&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; then the next code may do what you want:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 set have;
  by userid;
       retain start_income start_date;
       if first.userid then do;
          start_income = income;
          start_date = date.
       end;
      
      if last.userid then do;
         delta_income = income = start_income;
         delta_date = intck('month', date, start_date);
          output;
      end;
      keep userid delta_income delta_date;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 10:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-new-dataset-where-duplicate-rows-in-the-old-set-are/m-p/415983#M26755</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-11-24T10:35:25Z</dc:date>
    </item>
  </channel>
</rss>

