<?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 Compare_nested loops in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/912573#M359739</link>
    <description>&lt;P&gt;I have a column in which I want to check the similarity of the values. I want to delete those values whose first 10 characters are the same as the first 10 characters of some other value.&lt;BR /&gt;I thought I could solve it with two nested loops and a Compare function. But unfortunately it doesn't work.&lt;BR /&gt;Could someone help me?&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2024 22:20:47 GMT</pubDate>
    <dc:creator>Neptun83</dc:creator>
    <dc:date>2024-01-22T22:20:47Z</dc:date>
    <item>
      <title>Compare_nested loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/912573#M359739</link>
      <description>&lt;P&gt;I have a column in which I want to check the similarity of the values. I want to delete those values whose first 10 characters are the same as the first 10 characters of some other value.&lt;BR /&gt;I thought I could solve it with two nested loops and a Compare function. But unfortunately it doesn't work.&lt;BR /&gt;Could someone help me?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 22:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/912573#M359739</guid>
      <dc:creator>Neptun83</dc:creator>
      <dc:date>2024-01-22T22:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare_nested loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/912574#M359740</link>
      <description>&lt;P&gt;Are these "values" on the same observation? Nested do loops imply data step code and such a data step basically only wants to work on one observation at a time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Provide example data in the form of a working data step and the expected result. Paste the code for the data step into a text box opened with the &amp;lt;/&amp;gt; icon as the main message window reformats pasted text and the result may not actually run.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 22:25:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/912574#M359740</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-01-22T22:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Compare_nested loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/912578#M359742</link>
      <description>&lt;P&gt;This does what you asked for:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I want to delete those values whose first 10 characters are the same as the first 10 characters of some other value.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
create table want as 
  select * from have
  group by substr(COLUMN,1,10)
  having count(*)=1
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I suspect you actually want something different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 00:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/912578#M359742</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-23T00:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Compare_nested loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/912605#M359751</link>
      <description>&lt;P&gt;You should post sample data as a data step, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have;
  infile cards truncover;
  input txt $20.;
cards;
1234567890a  
1234567890b
z1234567890a  
z1234567890a432
;run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;One possible solution is to sort and compare:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have;
  by txt;
run;

data want;
  set have;
  if lag(substr(txt,1,10)) ne substr(txt,1,10);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jan 2024 08:10:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/912605#M359751</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2024-01-23T08:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Compare_nested loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/913118#M359910</link>
      <description>Thank you guys. I can solve the problem .</description>
      <pubDate>Fri, 26 Jan 2024 14:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/913118#M359910</guid>
      <dc:creator>Neptun83</dc:creator>
      <dc:date>2024-01-26T14:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Compare_nested loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/913221#M359949</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461511"&gt;@Neptun83&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you guys. I can solve the problem .&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Great.&amp;nbsp; But please report your solution, and mark it as the answer to your question (or just mark the "I can solve the problem" as the answer).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then the rest of us will not think this is a question still looking for an answer.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 23:42:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-nested-loops/m-p/913221#M359949</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-01-27T23:42:06Z</dc:date>
    </item>
  </channel>
</rss>

