<?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: Help with Proc Sort in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433422#M28034</link>
    <description>&lt;P&gt;A couple of things to consider ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, where are you headed with the results?&amp;nbsp; Depending on the planned analysis steps, there may be another way to get there.&amp;nbsp; It's easy enough to add to a subsequent analysis step:&amp;nbsp; where balance &amp;gt; 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, does the subsequent analysis require sorted data, or does it only require that the three new variables exist?&amp;nbsp; SQL (or even PROC FREQ) can get a count of the number of distinct values of REF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A good hash programmer (not me) should be able to create the three variables without sorting.&amp;nbsp; Well, any SAS programmer could create two out of the three.&amp;nbsp; But Unique_Count could be created by:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a HASH table based on REF.&amp;nbsp; Along the way, for each observation check whether that REF value already exists in the hash table.&amp;nbsp; If not, give Unique_Count a value of 1, and add that REF value to the hash table.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Feb 2018 08:31:32 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-02-02T08:31:32Z</dc:date>
    <item>
      <title>Help with Proc Sort</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433340#M28028</link>
      <description>&lt;P&gt;I have the below code which will sort by "Ref" and in the following datastep I use if first.Ref to return a Unique count.&lt;BR /&gt;&lt;BR /&gt;My question is. Is there a better more efficient way to do the proc sort or another way altogether to achieve what I doing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Proc Sort takes a while to run as I have over 17 million rows in the data I'm using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sort data=TestI;
	by Ref;
run;


data TestII;
	set TestI;
	by  Ref;
	if first. Ref then Unique_Count=1;
	if Balance &amp;gt;0 then IDB=Ref; 
	if Balance &amp;gt;0 then Balance_Count =1;

run;;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 01:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433340#M28028</guid>
      <dc:creator>Haydn</dc:creator>
      <dc:date>2018-02-02T01:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Proc Sort</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433407#M28032</link>
      <description>&lt;P&gt;Bottom line: proc sort is the quickest way to get a dataset sorted in SAS.&lt;/P&gt;
&lt;P&gt;But there are some tunable things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run the sort with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options fullstimer;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;so you get a clear picture if you're running out of CPU power or suffer form I/O waits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Separate your WORK and utility location (use the utilloc= option in your configuration file), so that they sit on physically separate volumes, if you use disks internal to the server.&lt;/P&gt;
&lt;P&gt;If your disks sit on a SAN, check with the SAN admin for possible hostspots, or other ways to improve storage performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you work with a compressed dataset (and a considerable compression rate), try the tagsort option in the proc sort statement. This prevents writing of an uncompressed utility file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some summary-related things can be done easier with proc summary/means. Depending on the cardinality of Ref, you might be better off with using proc summary with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;class Ref;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;avoiding the sort altogether. It's just that the summary structures for all unique values of Ref need to fit into available memory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 06:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433407#M28032</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-02-02T06:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Proc Sort</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433422#M28034</link>
      <description>&lt;P&gt;A couple of things to consider ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, where are you headed with the results?&amp;nbsp; Depending on the planned analysis steps, there may be another way to get there.&amp;nbsp; It's easy enough to add to a subsequent analysis step:&amp;nbsp; where balance &amp;gt; 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, does the subsequent analysis require sorted data, or does it only require that the three new variables exist?&amp;nbsp; SQL (or even PROC FREQ) can get a count of the number of distinct values of REF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A good hash programmer (not me) should be able to create the three variables without sorting.&amp;nbsp; Well, any SAS programmer could create two out of the three.&amp;nbsp; But Unique_Count could be created by:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a HASH table based on REF.&amp;nbsp; Along the way, for each observation check whether that REF value already exists in the hash table.&amp;nbsp; If not, give Unique_Count a value of 1, and add that REF value to the hash table.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 08:31:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433422#M28034</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-02T08:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Proc Sort</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433517#M28036</link>
      <description>&lt;P&gt;Here are some option to fast PROC SORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options bufno=100 bufsize=128k;
proc sort data=sashelp.class out=class sortsize=max noequals;&lt;BR /&gt;by sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Another fast way is spliting the big table into smalle table ,and combine them together.&lt;/P&gt;
&lt;P&gt;You can write a macro to automatic it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data F M;
 set sashelp.class;
if sex='F' then output F;
 else if sex='M' then output M;
run;

data want;
 set F M;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Feb 2018 09:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433517#M28036</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-02-03T09:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Proc Sort</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433578#M28039</link>
      <description>&lt;P&gt;Depending on your platform, there are also host specific options that may help.&amp;nbsp; For example, on Windows Server I've used SGIO (for mulit-gigabyte sized SAS data sets) and MEMLIB (to process the data in memory).&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 15:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Help-with-Proc-Sort/m-p/433578#M28039</guid>
      <dc:creator>DaveHorne</dc:creator>
      <dc:date>2018-02-02T15:42:14Z</dc:date>
    </item>
  </channel>
</rss>

