<?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 Indexing vs. Sorting in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Indexing-vs-Sorting/m-p/308311#M270664</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add two simple indexes to a large dataset based on "column1" and "column2". Is adding the two simple indexes effectively the same thing as sorting the dataset on "column1" and adding an index based on "column2" assuming that the datasets will not be sorted again in the future?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The options I'm considering are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc datasets library=mylib;
modify largeDataset;
index create column1;
index create column2;
quit;&lt;/PRE&gt;&lt;P&gt;vs.&lt;/P&gt;&lt;PRE&gt;proc sort data=mylib.largeDataset;
by column1;
run;

proc datasets library=mylib;
modify largeDataset;
index create column2;
quit;&lt;/PRE&gt;&lt;P&gt;Wouldn't the second option be more space efficient than the first?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS version 9.3&lt;/P&gt;</description>
    <pubDate>Mon, 31 Oct 2016 16:38:24 GMT</pubDate>
    <dc:creator>Adam_Black</dc:creator>
    <dc:date>2016-10-31T16:38:24Z</dc:date>
    <item>
      <title>Indexing vs. Sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indexing-vs-Sorting/m-p/308311#M270664</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add two simple indexes to a large dataset based on "column1" and "column2". Is adding the two simple indexes effectively the same thing as sorting the dataset on "column1" and adding an index based on "column2" assuming that the datasets will not be sorted again in the future?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The options I'm considering are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc datasets library=mylib;
modify largeDataset;
index create column1;
index create column2;
quit;&lt;/PRE&gt;&lt;P&gt;vs.&lt;/P&gt;&lt;PRE&gt;proc sort data=mylib.largeDataset;
by column1;
run;

proc datasets library=mylib;
modify largeDataset;
index create column2;
quit;&lt;/PRE&gt;&lt;P&gt;Wouldn't the second option be more space efficient than the first?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS version 9.3&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 16:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indexing-vs-Sorting/m-p/308311#M270664</guid>
      <dc:creator>Adam_Black</dc:creator>
      <dc:date>2016-10-31T16:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Indexing vs. Sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indexing-vs-Sorting/m-p/308313#M270665</link>
      <description>No, it's not the same. The main feature of indexes is to allow for direct access to individual records  (which in reality mens data page), which is beneficial for small subset operations. &lt;BR /&gt;Yes, by omitting an index you are saving space,  but again, you will not get the same functionality.</description>
      <pubDate>Mon, 31 Oct 2016 16:48:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indexing-vs-Sorting/m-p/308313#M270665</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-10-31T16:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Indexing vs. Sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Indexing-vs-Sorting/m-p/308323#M270666</link>
      <description>&lt;P&gt;There are other considerations besides storage space to hold an index.&amp;nbsp; Mainly, they focus on whether you are trying to retrieve all the observations vs. a subset.&amp;nbsp; Here's an earlier discussion that seems relevant:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Performance-SQL-vs-MERGE/td-p/117358" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Performance-SQL-vs-MERGE/td-p/117358&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 17:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Indexing-vs-Sorting/m-p/308323#M270666</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-31T17:07:32Z</dc:date>
    </item>
  </channel>
</rss>

