<?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: SPEDIS function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934474#M367471</link>
    <description>&lt;P&gt;SAS does not usually provide source code for its software as it is proprietary.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jul 2024 21:57:37 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2024-07-02T21:57:37Z</dc:date>
    <item>
      <title>SPEDIS function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934283#M367396</link>
      <description>&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;Hi,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;I'm new to SAS. I'm trying to understand the behavior of SPEDIS function.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;I ran below SAS code. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="2"&gt;&lt;CODE class=""&gt;data new;
a = spedis('uzfiy', 'fuziy');
run;&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;According to my understanding from SAS documentation :&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sirivally_1-1719850736853.png" style="width: 285px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98047iE36174AAC6D0B5C6/image-dimensions/285x77?v=v2" width="285" height="77" role="button" title="sirivally_1-1719850736853.png" alt="sirivally_1-1719850736853.png" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;Here, three operations are done&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="helvetica" size="2"&gt;Query | Keyword&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;&amp;nbsp; uzfiy&amp;nbsp; &amp;nbsp; &amp;nbsp; fuziy&amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;&amp;nbsp; &amp;nbsp; &lt;STRONG&gt;Operation&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; Cost&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;u - f&amp;nbsp; &amp;nbsp;=&amp;gt;&amp;nbsp; &amp;nbsp;firstrep&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 200&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;z - u&amp;nbsp; =&amp;gt;&amp;nbsp; &amp;nbsp;replace&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica" size="2"&gt;f - z&amp;nbsp; &amp;nbsp;=&amp;gt;&amp;nbsp; &amp;nbsp;replace&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;so, the result should be total cost / length of query =&amp;gt;&amp;nbsp; &amp;nbsp;(200 + 100 + 100)/ 5 = 80.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;But the actual result is 40.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;can you please give me the actual operations done in this case ? And is there a way to get the source code of SPEDIS function?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 16:35:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934283#M367396</guid>
      <dc:creator>sirivally</dc:creator>
      <dc:date>2024-07-01T16:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: SPEDIS function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934386#M367426</link>
      <description>&lt;P&gt;The function tries for operations with the lowest score.&lt;/P&gt;
&lt;P&gt;Consider:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
  a = spedis('ABC', 'XAX');  
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This has a cost of 300 (and a distance of 100):&lt;/P&gt;
&lt;P&gt;Swap A to first position: cost=100&lt;/P&gt;
&lt;P&gt;Replace the other 2 letters: cost =2x100&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replacing everything would cost 200+100+100=400.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly in your case, there are swaps rather than replacements used in the process.&lt;/P&gt;
&lt;P&gt;Letters u and z can be put in the correct position with a swap, and f has to be inserted. Cost = 2x50+100 = 200, for a distance of 200/5 = 40.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 11:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934386#M367426</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-07-02T11:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: SPEDIS function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934388#M367428</link>
      <description>&lt;P&gt;if you swap f and u&amp;nbsp;uzfiy you done and you get 200/5=40&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 12:27:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934388#M367428</guid>
      <dc:creator>rudfaden</dc:creator>
      <dc:date>2024-07-02T12:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: SPEDIS function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934391#M367431</link>
      <description>Sorry. All wrong.</description>
      <pubDate>Tue, 02 Jul 2024 12:44:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934391#M367431</guid>
      <dc:creator>rudfaden</dc:creator>
      <dc:date>2024-07-02T12:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: SPEDIS function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934406#M367436</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;Thank you for your response.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Just want to make sure if it is 4 swaps or 2 swaps + 1 insertion in my case&amp;nbsp; ?&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;If 4 swaps:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;U&gt;uz&lt;/U&gt;fiy - &lt;U&gt;zu&lt;/U&gt;fiy&amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; 50&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;z&lt;U&gt;uf&lt;/U&gt;iy - z&lt;U&gt;fu&lt;/U&gt;iy&amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; 50&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;U&gt;zf&lt;/U&gt;uiy - &lt;U&gt;fz&lt;/U&gt;uiy&amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; 50&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;f&lt;U&gt;zu&lt;/U&gt;iy - f&lt;U&gt;uz&lt;/U&gt;iy&amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; 50&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;=&amp;nbsp; 200&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;SPEDIS - 200/5 = 40&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;And is there a way to get the source code of SPEDIS function?&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 14:51:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934406#M367436</guid>
      <dc:creator>sirivally</dc:creator>
      <dc:date>2024-07-02T14:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: SPEDIS function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934474#M367471</link>
      <description>&lt;P&gt;SAS does not usually provide source code for its software as it is proprietary.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 21:57:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934474#M367471</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-07-02T21:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: SPEDIS function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934522#M367488</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/443546"&gt;@sirivally&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;And is there a way to get the source code of SPEDIS function?&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have to ask SAS themselves for this, but I doubt they will provide it. SAS itself is not open source.&lt;/P&gt;
&lt;P&gt;And it would only be helpful if you're good with C.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2024 11:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934522#M367488</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-07-03T11:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: SPEDIS function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934530#M367492</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Just want to make sure if it is 4 swaps or 2 swaps + 1 insertion in my case&amp;nbsp; ?&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="2"&gt;You swap from the start string, not from another combination. Otherwise you could just move a letter along till the end.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2024 10:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934530#M367492</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-07-03T10:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: SPEDIS function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934532#M367494</link>
      <description>&lt;P&gt;I still don't get how 2 swaps + 1 insert can work. After the swaps, you'd still have 5 characters, and the insert would result in 6 characters overall.&lt;/P&gt;
&lt;P&gt;Could you please elaborate how the exact sequence 2 swaps + 1 insert works with the original text of the OP?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2024 11:10:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934532#M367494</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-07-03T11:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: SPEDIS function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934536#M367497</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I still don't get how 2 swaps + 1 insert can work&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;I meant 2 swaps + 1 replace, sorry about the confusion.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2024 12:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SPEDIS-function/m-p/934536#M367497</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-07-03T12:26:49Z</dc:date>
    </item>
  </channel>
</rss>

