<?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 i want to sort the data in array and removing duplicate without using function and procs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812340#M320511</link>
    <description>&lt;P&gt;I want to sort the element in array and removing duplicate without using any procs and function. Please help me to get this solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eg: {2 3 5 2 7 6 7 1}&amp;nbsp; output {1 2 3 4 5 6 7}&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 May 2022 10:01:35 GMT</pubDate>
    <dc:creator>Sagar_Pawar</dc:creator>
    <dc:date>2022-05-10T10:01:35Z</dc:date>
    <item>
      <title>i want to sort the data in array and removing duplicate without using function and procs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812340#M320511</link>
      <description>&lt;P&gt;I want to sort the element in array and removing duplicate without using any procs and function. Please help me to get this solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eg: {2 3 5 2 7 6 7 1}&amp;nbsp; output {1 2 3 4 5 6 7}&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 10:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812340#M320511</guid>
      <dc:creator>Sagar_Pawar</dc:creator>
      <dc:date>2022-05-10T10:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: i want to sort the data in array and removing duplicate without using function and procs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812341#M320512</link>
      <description>&lt;P&gt;You can let the hash object do the sort and dedup like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 
   array x {8} (2 3 5 2 7 6 7 1);
 
   dcl hash h (ordered : "A");
   h.definekey ("_x");
   h.definedone();
   dcl hiter hi ("h");
 
   do _N_ = lbound(x) to hbound(x);
       _x = x[_N_];
       rc = h.add();
   end;

   put "Before Sort: " / (x[*])(=) /;
   
   call missing(of x[*]);
 
   do _N_ = lbound(x) to h.num_items;
       rc = hi.next();
       x[_N_] = _x;
   end;
 
   put "After Sort:  " / (x[*])(=);
 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Result:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; Before Sort: 
 x1=2 x2=3 x3=5 x4=2 x5=7 x6=6 x7=7 x8=1
 After Sort:  
 x1=1 x2=2 x3=3 x4=5 x5=6 x6=7 x7=. x8=.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: Just edited the code a bit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 10:22:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812341#M320512</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-05-10T10:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: i want to sort the data in array and removing duplicate without using function and procs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812342#M320513</link>
      <description>&lt;P&gt;CALL SORT can sort the array for you, but you'll have to dedupe yourself.&lt;/P&gt;
&lt;P&gt;Note that the array size doesn't change so you'll have missing values in the output if you removed duplicates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 10:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812342#M320513</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2022-05-10T10:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: i want to sort the data in array and removing duplicate without using function and procs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812346#M320515</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/425047"&gt;@Sagar_Pawar&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I want to sort the element in array and removing duplicate without using any procs and function. Please help me to get this solution.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This makes no sense. Anything you do in SAS DATA steps uses a function. Even if you type &amp;lt; meaning less than, it is a function. Hash objects are functions.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 10:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812346#M320515</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-05-10T10:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: i want to sort the data in array and removing duplicate without using function and procs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812353#M320516</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/425047"&gt;@Sagar_Pawar&lt;/a&gt;&amp;nbsp;, just to be clear, your have - and want arrays do not match. There is a 4 in your want array. There is not in the have array &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 11:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812353#M320516</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-05-10T11:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: i want to sort the data in array and removing duplicate without using function and procs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812354#M320517</link>
      <description>&lt;P&gt;Suggest you go to lexjansen.com, search for sort array, and enjoy the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can never go wrong with a paper by Paul Dofrman:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi26/p096-26.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/sugi26/p096-26.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you'll find plenty more like that in Lex's index.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 11:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812354#M320517</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-05-10T11:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: i want to sort the data in array and removing duplicate without using function and procs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812356#M320519</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;agree, such a masterpiece.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 11:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812356#M320519</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-05-10T11:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: i want to sort the data in array and removing duplicate without using function and procs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812401#M320542</link>
      <description>&lt;P&gt;Without using Functions and Procs, it can be done by programming. Assuming you have an array of medium size you can use simple and fairly easy insertion sort to sort the elements in place. The duplicate items will be marked as missing values in the array. If you have larger array of size in millions, use Quicksort but you have to modify the code to catch the duplicate items. Hope this interests you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
array k[8] _temporary_ (2 3 5 2 7 6 7 1);
   do i = 1 to dim(k) - 1;
      do j = i+1 to dim(k);
         if k[i] = k[j] then do; k[j] =.; continue; end;
         if k[i] &amp;gt; k[j] then do;
            t = k[i];
            k[i] = k[j];
            k[j] = t;
         end;
      end;
   end;
   
   do i = 1 to dim(k);
      put k[i] =;
   end;

run;


k[1]=1
k[2]=.
k[3]=2
k[4]=3
k[5]=5
k[6]=6
k[7]=.
k[8]=7
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 May 2022 13:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/i-want-to-sort-the-data-in-array-and-removing-duplicate-without/m-p/812401#M320542</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2022-05-10T13:52:48Z</dc:date>
    </item>
  </channel>
</rss>

