<?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 Ordering with respect to a custom order in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ordering-with-respect-to-a-custom-order/m-p/325021#M21699</link>
    <description>&lt;P&gt;I'm using SAS EG 5.1 on Windows 7.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the&amp;nbsp;following sample input.&lt;/P&gt;&lt;P&gt;&lt;IMG title="Input.jpg" alt="Input.jpg" src="https://communities.sas.com/t5/image/serverpage/image-id/6740iB4CD44D2A33E69BA/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wish to order this input in such a way that whenever different observations match on ID and on Time, the final state of a given observation matches the initial state of the next observation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output should look like this:&lt;/P&gt;&lt;P&gt;&lt;IMG title="Output.jpg" alt="Output.jpg" src="https://communities.sas.com/t5/image/serverpage/image-id/6742i1FAD3E5D00135396/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm at a loss on how to do this. Any help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code that generates the input table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Test;
   Infile datalines delimiter=','; 
   Input ID Initial_Stafe $ Final_State $ Time;
   Datalines;
   123,AA,BB,201701020923
   123,BB,CC,201701020930
   156,AA,AA,201701020910
   163,AC,BC,201701031010
   163,DD,CC,201701031010
   163,BC,DD,201701031010
   163,CC,BB,201701031010
   170,BB,.,201701040930
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jan 2017 13:03:33 GMT</pubDate>
    <dc:creator>sleretrano</dc:creator>
    <dc:date>2017-01-16T13:03:33Z</dc:date>
    <item>
      <title>Ordering with respect to a custom order</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ordering-with-respect-to-a-custom-order/m-p/325021#M21699</link>
      <description>&lt;P&gt;I'm using SAS EG 5.1 on Windows 7.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the&amp;nbsp;following sample input.&lt;/P&gt;&lt;P&gt;&lt;IMG title="Input.jpg" alt="Input.jpg" src="https://communities.sas.com/t5/image/serverpage/image-id/6740iB4CD44D2A33E69BA/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wish to order this input in such a way that whenever different observations match on ID and on Time, the final state of a given observation matches the initial state of the next observation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output should look like this:&lt;/P&gt;&lt;P&gt;&lt;IMG title="Output.jpg" alt="Output.jpg" src="https://communities.sas.com/t5/image/serverpage/image-id/6742i1FAD3E5D00135396/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm at a loss on how to do this. Any help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code that generates the input table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Test;
   Infile datalines delimiter=','; 
   Input ID Initial_Stafe $ Final_State $ Time;
   Datalines;
   123,AA,BB,201701020923
   123,BB,CC,201701020930
   156,AA,AA,201701020910
   163,AC,BC,201701031010
   163,DD,CC,201701031010
   163,BC,DD,201701031010
   163,CC,BB,201701031010
   170,BB,.,201701040930
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 13:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ordering-with-respect-to-a-custom-order/m-p/325021#M21699</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2017-01-16T13:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering with respect to a custom order</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ordering-with-respect-to-a-custom-order/m-p/325036#M21700</link>
      <description>&lt;P&gt;Assuming that state has logical (and unbreakable) path.&lt;/P&gt;
&lt;P&gt;Also assuming&amp;nbsp;that state is global, the order is the same independent&amp;nbsp;of id, or...?&lt;/P&gt;
&lt;P&gt;If so, create a lookup&amp;nbsp;table with a your state and a numerical order by variable, merge/join to get this order by variable, and then resort.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 14:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ordering-with-respect-to-a-custom-order/m-p/325036#M21700</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-01-16T14:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering with respect to a custom order</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ordering-with-respect-to-a-custom-order/m-p/325040#M21701</link>
      <description>Thank you for your time.&lt;BR /&gt;Yes, assume that there always is a "proper" path.&lt;BR /&gt;&lt;BR /&gt;I'm not sure I understand your question, The ordering, by descending priority is: ID, Time, Path.&lt;BR /&gt;&lt;BR /&gt;Can you please provide the code to your suggestion?</description>
      <pubDate>Mon, 16 Jan 2017 14:44:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ordering-with-respect-to-a-custom-order/m-p/325040#M21701</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2017-01-16T14:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering with respect to a custom order</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ordering-with-respect-to-a-custom-order/m-p/325056#M21702</link>
      <description>Nothing fancy just like:&lt;BR /&gt;Create table want as&lt;BR /&gt;Select have.*&lt;BR /&gt;From have&lt;BR /&gt;Inner join state_lookup&lt;BR /&gt;On have.initial_state = state_lookup.state &lt;BR /&gt;Order by state_lookup.state_order&lt;BR /&gt;;</description>
      <pubDate>Mon, 16 Jan 2017 16:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ordering-with-respect-to-a-custom-order/m-p/325056#M21702</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-01-16T16:12:05Z</dc:date>
    </item>
  </channel>
</rss>

