<?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: sas data table transformation in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247141#M6528</link>
    <description>&lt;P&gt;I am Sorry it got posted 3 times by mistake as I wasn't sure which category is right to post in. Will avoid this duplicate submission in future. Thanks for the innovative solution and bringing this up.&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 31 Jan 2016 23:35:37 GMT</pubDate>
    <dc:creator>Arora_S</dc:creator>
    <dc:date>2016-01-31T23:35:37Z</dc:date>
    <item>
      <title>sas data table transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247064#M6524</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I want to transofrm data that looks like as below:&lt;/P&gt;
&lt;P&gt;and has followingfields :--&amp;gt; patid, date on which a medical team was added/removed, type of team , and action&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="236"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="39"&gt;patid&lt;/TD&gt;
&lt;TD width="78"&gt;date&lt;/TD&gt;
&lt;TD width="56"&gt;Team&lt;/TD&gt;
&lt;TD width="63"&gt;action&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1111&lt;/TD&gt;
&lt;TD&gt;jan-25-2016&lt;/TD&gt;
&lt;TD&gt;medical&lt;/TD&gt;
&lt;TD&gt;added&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1111&lt;/TD&gt;
&lt;TD&gt;jan-27-2016&lt;/TD&gt;
&lt;TD&gt;surgical&lt;/TD&gt;
&lt;TD&gt;added&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1111&lt;/TD&gt;
&lt;TD&gt;29-Jan&lt;/TD&gt;
&lt;TD&gt;medical&lt;/TD&gt;
&lt;TD&gt;removed&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1111&lt;/TD&gt;
&lt;TD&gt;31-Jan&lt;/TD&gt;
&lt;TD&gt;obgyn&lt;/TD&gt;
&lt;TD&gt;added&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;The output that i need shoud be in this way:so for each date i have the team in one row and for missing dates i can populate&lt;/P&gt;
&lt;P&gt;them as below...what is the most efficent way to do this in sas base sas ??ANy help will behighly&amp;nbsp; appreciated...&lt;/P&gt;
&lt;P&gt;thanks guys&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="300"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="39"&gt;patid&lt;/TD&gt;
&lt;TD width="78"&gt;date&lt;/TD&gt;
&lt;TD width="56"&gt;team1&lt;/TD&gt;
&lt;TD width="63"&gt;team2&lt;/TD&gt;
&lt;TD width="64"&gt;team3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1111&lt;/TD&gt;
&lt;TD&gt;jan-25-2016&lt;/TD&gt;
&lt;TD&gt;medical&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1111&lt;/TD&gt;
&lt;TD&gt;26-Jan&lt;/TD&gt;
&lt;TD&gt;medical&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1111&lt;/TD&gt;
&lt;TD&gt;27-Jan&lt;/TD&gt;
&lt;TD&gt;medical&lt;/TD&gt;
&lt;TD&gt;surgical&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1111&lt;/TD&gt;
&lt;TD&gt;28-Jan&lt;/TD&gt;
&lt;TD&gt;medical&lt;/TD&gt;
&lt;TD&gt;surgical&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1111&lt;/TD&gt;
&lt;TD&gt;29-Jan&lt;/TD&gt;
&lt;TD&gt;surgical&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1111&lt;/TD&gt;
&lt;TD&gt;30-Jan&lt;/TD&gt;
&lt;TD&gt;surgical&lt;/TD&gt;
&lt;TD&gt;obgyn&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;1111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31-jan&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; surgical&amp;nbsp;&amp;nbsp;&amp;nbsp; obgyn&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 16:39:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247064#M6524</guid>
      <dc:creator>Arora_S</dc:creator>
      <dc:date>2016-02-01T16:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: sas data table transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247075#M6527</link>
      <description>&lt;DIV class="lia-quilt-row lia-quilt-row-forum-message-main"&gt;
&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-right lia-quilt-column-main-right"&gt;
&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-right"&gt;
&lt;DIV id="messagebodydisplay_0_1" class="lia-message-body lia-component-body"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;You posted your same question &lt;STRONG&gt;THREE&amp;nbsp;times&lt;/STRONG&gt; in THREE&amp;nbsp;&lt;SPAN&gt;Community&lt;/SPAN&gt; !!!!! Why?&lt;/P&gt;
&lt;P&gt;One possible Solution:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
by patid date;
array Team_[5] $;
retain Team_ arrindex;
if first.patid then do;arrindex=0; call missing (of Team_[*]);end;
if trim(action) eq "added" then do;
	arrindex = arrindex+1;
	Team_[arrindex]=team;
end;
else if trim(action) eq "removed" and arrindex ~= 0 then do;
	Do i=1 to dim(Team_) by 1;
		if  Team_[i]=team then do;
			do j=i to arrindex-1;
				Team_[j]=Team_[j+1];
			end;
			Team_[j]="";
			arrindex=arrindex-1;
			leave;
		end;
	end;
end;
else return;
drop i j arrindex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Sun, 31 Jan 2016 01:26:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247075#M6527</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2016-01-31T01:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: sas data table transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247141#M6528</link>
      <description>&lt;P&gt;I am Sorry it got posted 3 times by mistake as I wasn't sure which category is right to post in. Will avoid this duplicate submission in future. Thanks for the innovative solution and bringing this up.&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Jan 2016 23:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247141#M6528</guid>
      <dc:creator>Arora_S</dc:creator>
      <dc:date>2016-01-31T23:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: sas data table transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247144#M6529</link>
      <description>&lt;P&gt;Then kindly if that match your requirements close the thread by marking the reply as "Accepted Solution".&lt;/P&gt;</description>
      <pubDate>Sun, 31 Jan 2016 23:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247144#M6529</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2016-01-31T23:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: sas data table transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247224#M6531</link>
      <description>&lt;P&gt;The dates are not getting populated well in output&lt;/P&gt;
&lt;P&gt;for example:&lt;/P&gt;
&lt;P&gt;for missing dates , i want to populate them based on info from the previous non missing row as in output..&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 18:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247224#M6531</guid>
      <dc:creator>Arora_S</dc:creator>
      <dc:date>2016-02-01T18:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: sas data table transformation</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247270#M6546</link>
      <description>&lt;P&gt;Its a partial solution as dates are not getting populated where sequence missing&amp;nbsp;&amp;nbsp;but I&amp;nbsp;find it&amp;nbsp;very helpful to address problem using your approach..&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 18:34:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/sas-data-table-transformation/m-p/247270#M6546</guid>
      <dc:creator>Arora_S</dc:creator>
      <dc:date>2016-02-01T18:34:48Z</dc:date>
    </item>
  </channel>
</rss>

