<?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 CREATING GROUPS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258265#M268970</link>
    <description>&lt;P&gt;Actually, it is not really necessary. i can keep only the room numbers.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Mar 2016 16:50:17 GMT</pubDate>
    <dc:creator>lerdem</dc:creator>
    <dc:date>2016-03-22T16:50:17Z</dc:date>
    <item>
      <title>SAS CREATING GROUPS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258227#M268967</link>
      <description>&lt;P&gt;I have output as below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;type &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; building &amp;nbsp; room &amp;nbsp; begin &amp;nbsp; &amp;nbsp; end&lt;/P&gt;
&lt;P&gt;event &amp;nbsp; &amp;nbsp; &amp;nbsp;25mar16 &amp;nbsp; &amp;nbsp;OC-001 &amp;nbsp; 101 &amp;nbsp; &amp;nbsp; &amp;nbsp;1200 &amp;nbsp; &amp;nbsp; 1600&lt;/P&gt;
&lt;P&gt;section &amp;nbsp; 25mar16 &amp;nbsp; &amp;nbsp; OC-001 &amp;nbsp; 104 &amp;nbsp; &amp;nbsp; &amp;nbsp;930 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1320&lt;/P&gt;
&lt;P&gt;event &amp;nbsp; &amp;nbsp; &amp;nbsp;25mar16 &amp;nbsp; &amp;nbsp;OC-001 &amp;nbsp; &amp;nbsp;114 &amp;nbsp; &amp;nbsp; &amp;nbsp;1230 &amp;nbsp; &amp;nbsp; 1600&lt;/P&gt;
&lt;P&gt;section &amp;nbsp; &amp;nbsp;25mar16 &amp;nbsp; &amp;nbsp;OC-002 &amp;nbsp; &amp;nbsp;203 &amp;nbsp; &amp;nbsp; 1200 &amp;nbsp; &amp;nbsp;1700&lt;/P&gt;
&lt;P&gt;section &amp;nbsp; &amp;nbsp;25mar16 &amp;nbsp; &amp;nbsp;OC-002 &amp;nbsp; &amp;nbsp;101 &amp;nbsp; &amp;nbsp; &amp;nbsp;1400 &amp;nbsp; &amp;nbsp;1800&lt;/P&gt;
&lt;P&gt;event &amp;nbsp; &amp;nbsp; &amp;nbsp;25mar16 &amp;nbsp; &amp;nbsp; OC-002 &amp;nbsp; &amp;nbsp;204 &amp;nbsp; &amp;nbsp; &amp;nbsp;1000 &amp;nbsp; &amp;nbsp;1130&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what i need is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;building &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;room &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end&lt;/P&gt;
&lt;P&gt;OC-001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;101, 104, 114 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1600&lt;/P&gt;
&lt;P&gt;OC-002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;203, 101,204 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1800&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 16:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258227#M268967</guid>
      <dc:creator>lerdem</dc:creator>
      <dc:date>2016-03-22T16:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CREATING GROUPS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258235#M268968</link>
      <description>&lt;P&gt;Where does the "1-" or "2-" come from?&amp;nbsp; Is it the last character in BUILDING or the first character in ROOM?&amp;nbsp; Do you really need it?&amp;nbsp; If it comes from BUILDING, could it be 2 or even 3 digits long?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 15:40:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258235#M268968</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-22T15:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CREATING GROUPS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258259#M268969</link>
      <description>&lt;P&gt;And confirm a rule for selecting the value of End in the output. It could be the max value or in your example data the value associated with room 101 ...&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 16:37:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258259#M268969</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-22T16:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CREATING GROUPS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258265#M268970</link>
      <description>&lt;P&gt;Actually, it is not really necessary. i can keep only the room numbers.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 16:50:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258265#M268970</guid>
      <dc:creator>lerdem</dc:creator>
      <dc:date>2016-03-22T16:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CREATING GROUPS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258277#M268971</link>
      <description>&lt;P&gt;End is the maximum value for each building. Thanks for help&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 17:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258277#M268971</guid>
      <dc:creator>lerdem</dc:creator>
      <dc:date>2016-03-22T17:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CREATING GROUPS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258282#M268972</link>
      <description>Use RETAIN for concatenated room variable and store the max of end within each building (BY).</description>
      <pubDate>Tue, 22 Mar 2016 17:30:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258282#M268972</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-03-22T17:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CREATING GROUPS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258284#M268973</link>
      <description>&lt;P&gt;To add some detail to Linus's suggestion ... assuming your data is sorted by BUILDING:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by building;&lt;/P&gt;
&lt;P&gt;length room_list $ 30;&lt;/P&gt;
&lt;P&gt;retain room_list end_time;&lt;/P&gt;
&lt;P&gt;if first.building then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; room_list = room;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end_time = end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;else do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; room_list = catx(', ', room_list, room);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end_time = max(end_time, end);&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;if last.building;&lt;/P&gt;
&lt;P&gt;keep building room_list end_time;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I would suggest that you don't name a variable END.&amp;nbsp; That is also a SAS statement and the combination can lead to confusing code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 17:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258284#M268973</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-22T17:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CREATING GROUPS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258400#M268974</link>
      <description>&lt;P&gt;Perfect fit for a &lt;STRONG&gt;do until()&lt;/STRONG&gt; loop :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt;input type $ date :date9. building $ room $ begin end;&lt;BR /&gt;datalines;&lt;BR /&gt;event 25mar16 OC-001 101 1200 1600&lt;BR /&gt;section 25mar16 OC-001 104 930 1320&lt;BR /&gt;event 25mar16 OC-001 114 1230 1600&lt;BR /&gt;section 25mar16 OC-002 203 1200 1700&lt;BR /&gt;section 25mar16 OC-002 101 1400 1800&lt;BR /&gt;event 25mar16 OC-002 204 1000 1130&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;length roomList $64;&lt;BR /&gt;do until (last.building);&lt;BR /&gt; set have; by building notsorted;&lt;BR /&gt; roomList = catx(", ", roomList, room);&lt;BR /&gt; endTime = max(endTime, end);&lt;BR /&gt; end;&lt;BR /&gt;keep building roomList endTime;&lt;BR /&gt;rename roomList=room endTime=end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc print data=want noobs; run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Mar 2016 03:00:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258400#M268974</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-03-23T03:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CREATING GROUPS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258539#M268975</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats﻿&lt;/a&gt;. Would endtime variable be initialized as zero or missing at the beginning?&lt;BR /&gt;&lt;BR /&gt;endTime = max(endTime, end);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked it initializes with missing value. I also wonder how to check what is going on during one complete dow-loop interation? I also read DOW-LOOP does automatic retain, how does it do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	length roomList $64;
     put _all_;
	do until (last.building);
		set have;
		by building notsorted;
		roomList = catx(", ", roomList, room);
		endTime = max(endTime, end);
	end;
	put _all_;

	keep building roomList endTime;
	rename roomList=room endTime=end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 14:53:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258539#M268975</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-03-23T14:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS CREATING GROUPS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258565#M268976</link>
      <description>&lt;P&gt;Variables created within a data step are reset to missing at the beginning of each implicit step iteration. The do until() loops inside a single data step iteration, so it doesn't encounter this automatic reset. After each building group however, roomList and endTime are reset to missing as the data step does its implicit looping. Both functions CATX and MAX handle missing arguments appropriately.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 15:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-CREATING-GROUPS/m-p/258565#M268976</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-03-23T15:36:20Z</dc:date>
    </item>
  </channel>
</rss>

