<?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: Checking for multiple numbers in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Checking-for-multiple-numbers/m-p/34630#M8484</link>
    <description>Hi Wouter.&lt;BR /&gt;
If your dataset is already sorted, what you can do is :&lt;BR /&gt;
[pre]&lt;BR /&gt;
DATA myData ;&lt;BR /&gt;
  SET myData ;&lt;BR /&gt;
  BY myVariable ;&lt;BR /&gt;
  IF NOT (FIRST.myVariable AND LAST.myVariable) THEN flag = 1 ;&lt;BR /&gt;
  ELSE flag = 0 ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Regards&lt;BR /&gt;
Olivier</description>
    <pubDate>Mon, 28 Jul 2008 18:26:39 GMT</pubDate>
    <dc:creator>Olivier</dc:creator>
    <dc:date>2008-07-28T18:26:39Z</dc:date>
    <item>
      <title>Checking for multiple numbers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Checking-for-multiple-numbers/m-p/34629#M8483</link>
      <description>Hi all!&lt;BR /&gt;
&lt;BR /&gt;
Should be a simple task, but I don't get the code right...&lt;BR /&gt;
&lt;BR /&gt;
I want to know (and FLAG) if a record contains a 1 time number or if there are other records with the same number. So I've got a dataset like:&lt;BR /&gt;
&lt;BR /&gt;
1 text&lt;BR /&gt;
2 text&lt;BR /&gt;
2 text&lt;BR /&gt;
3 text&lt;BR /&gt;
4 text&lt;BR /&gt;
4 text&lt;BR /&gt;
4 text&lt;BR /&gt;
&lt;BR /&gt;
I want to create a 'FLAG', so I know a number appears more than once in the dataset. The outcome should be something like:&lt;BR /&gt;
&lt;BR /&gt;
1 text 0&lt;BR /&gt;
2 text 1&lt;BR /&gt;
2 text 1&lt;BR /&gt;
3 text 0&lt;BR /&gt;
4 text 1&lt;BR /&gt;
4 text 1&lt;BR /&gt;
4 text 1&lt;BR /&gt;
&lt;BR /&gt;
Can anyone help me with this? Thanks!!</description>
      <pubDate>Mon, 28 Jul 2008 16:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Checking-for-multiple-numbers/m-p/34629#M8483</guid>
      <dc:creator>Wouter</dc:creator>
      <dc:date>2008-07-28T16:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for multiple numbers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Checking-for-multiple-numbers/m-p/34630#M8484</link>
      <description>Hi Wouter.&lt;BR /&gt;
If your dataset is already sorted, what you can do is :&lt;BR /&gt;
[pre]&lt;BR /&gt;
DATA myData ;&lt;BR /&gt;
  SET myData ;&lt;BR /&gt;
  BY myVariable ;&lt;BR /&gt;
  IF NOT (FIRST.myVariable AND LAST.myVariable) THEN flag = 1 ;&lt;BR /&gt;
  ELSE flag = 0 ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Regards&lt;BR /&gt;
Olivier</description>
      <pubDate>Mon, 28 Jul 2008 18:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Checking-for-multiple-numbers/m-p/34630#M8484</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2008-07-28T18:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for multiple numbers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Checking-for-multiple-numbers/m-p/34631#M8485</link>
      <description>Thanks! Works perfectly! Should have thought of myself...!</description>
      <pubDate>Wed, 30 Jul 2008 14:22:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Checking-for-multiple-numbers/m-p/34631#M8485</guid>
      <dc:creator>Wouter</dc:creator>
      <dc:date>2008-07-30T14:22:04Z</dc:date>
    </item>
  </channel>
</rss>

