<?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: Table rearrangement in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694215#M25104</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/311215"&gt;@cactooos&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you for that, but that is the point that it can be any even number of rows in this table and &lt;FONT color="#FF0000"&gt;all of them could be for one day as well&lt;/FONT&gt;.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This was not mentioned in the original message. If they are always in pairs, then the solution from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;should work well.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Oct 2020 11:29:33 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-10-26T11:29:33Z</dc:date>
    <item>
      <title>Table rearrangement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694210#M25100</link>
      <description>&lt;P&gt;Hi, Could you please help me to rearrange the build of this table? It can have from 0 rows to anything but hardly this will be the case of more than 20. I am already using macro variable &amp;amp;noobs_have elsewhere. I want the table to be like on the pic below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;data have;
  input day : $9. Date : $16. delta;
  cards;
22OCT2020 22OCT20:15:19:10 0
22OCT2020 22OCT20:15:25:20 370
23OCT2020 23OCT20:00:19:54 2
23OCT2020 23OCT20:00:20:02 8
  ;
run;

data _NULL_;
 if 0 then set have nobs=n;
 call symputx('noobs_have',n);
 stop;
run;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 788px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51055i57B502426034C89A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for any help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 11:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694210#M25100</guid>
      <dc:creator>cactooos</dc:creator>
      <dc:date>2020-10-26T11:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Table rearrangement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694211#M25101</link>
      <description>&lt;P&gt;Transposing the data is a way to do this, and then you don't need to know how many rows there are, because PROC TRANSPOSE takes care of that for you. This solution assumes there are never more than two rows on a given day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input day :date9. Date :datetime16. delta;
  format day date9. date datetime16.;
  cards;
22OCT2020 22OCT20:15:19:10 0
22OCT2020 22OCT20:15:25:20 370
23OCT2020 23OCT20:00:19:54 2
23OCT2020 23OCT20:00:20:02 8
  ;
run;
proc transpose data=have out=have_t;
	by day;
	var date;
run;
data want;
	set have_t;
	delta=col2-col1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Oct 2020 11:19:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694211#M25101</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-26T11:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Table rearrangement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694212#M25102</link>
      <description>&lt;PRE&gt;data have;
  input day : $9. Date : $16. delta;
  cards;
22OCT2020 22OCT20:15:19:10 0
22OCT2020 22OCT20:15:25:20 370
23OCT2020 23OCT20:00:19:54 2
23OCT2020 23OCT20:00:20:02 8
  ;
run;

data want;
 do until(last.day);
  set have;
  by day;
  if first.day then from=date;
 end;
 to=date;
 keep day from to delta;
 run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Oct 2020 11:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694212#M25102</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-10-26T11:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Table rearrangement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694213#M25103</link>
      <description>Thank you for that, but that is the point that it can be any even number of rows in this table and all of them could be for one day as well.</description>
      <pubDate>Mon, 26 Oct 2020 11:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694213#M25103</guid>
      <dc:creator>cactooos</dc:creator>
      <dc:date>2020-10-26T11:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Table rearrangement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694215#M25104</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/311215"&gt;@cactooos&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you for that, but that is the point that it can be any even number of rows in this table and &lt;FONT color="#FF0000"&gt;all of them could be for one day as well&lt;/FONT&gt;.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This was not mentioned in the original message. If they are always in pairs, then the solution from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;should work well.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 11:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694215#M25104</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-26T11:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Table rearrangement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694217#M25105</link>
      <description>&lt;P&gt;Thanks, I didn't mention that in the first message. They always comes as a pair but can be any number of pairs per table and per day. So this is also possible:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input day : $9. Date : $16. delta;
  cards;
22OCT2020 22OCT20:15:19:10 0
22OCT2020 22OCT20:15:25:20 370
22OCT2020 22OCT20:16:19:10 0
22OCT2020 22OCT20:16:25:30 380
22OCT2020 22OCT20:17:19:10 0
22OCT2020 22OCT20:17:25:40 390
24OCT2020 24OCT20:00:19:54 2
24OCT2020 24OCT20:00:20:02 8
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Oct 2020 11:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694217#M25105</guid>
      <dc:creator>cactooos</dc:creator>
      <dc:date>2020-10-26T11:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Table rearrangement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694222#M25106</link>
      <description>&lt;P&gt;Another solution is to assign an ID number to the pairs, and then use PROC TRANSPOSE as I showed with BY ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input day :date9. Date :datetime16. delta;
  id = floor((_n_-1)/2);
  format day date9. date datetime16.;
  cards;
...
  ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 12:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Table-rearrangement/m-p/694222#M25106</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-26T12:33:43Z</dc:date>
    </item>
  </channel>
</rss>

