<?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 seq number issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/seq-number-issue/m-p/934904#M367593</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
set sashelp.class;
if mod(_n_,2)=1 then seq=1;output;
else  mod(_n_,2)=0 then seq=1+1;

    output;
keep name seq;
proc print noobs;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;required output&lt;BR /&gt;Name Seq&lt;BR /&gt;Alfred 1&lt;BR /&gt;Alice 1&lt;BR /&gt;Alice 1&lt;BR /&gt;Barbara 2&lt;BR /&gt;Carol 2&lt;BR /&gt;Carol 2&lt;BR /&gt;Henry 3&lt;BR /&gt;James 3&lt;BR /&gt;James 3&lt;BR /&gt;Jane 4&lt;BR /&gt;Janet 4&lt;BR /&gt;Janet 4&lt;BR /&gt;Jeffrey 5&lt;BR /&gt;John 5&lt;BR /&gt;John 5&lt;BR /&gt;Joyce 6&lt;BR /&gt;Judy 6&lt;BR /&gt;Judy 6&lt;BR /&gt;Louise 7&lt;BR /&gt;Mary 7&lt;BR /&gt;Mary 7&lt;BR /&gt;Philip 8&lt;BR /&gt;Robert 8&lt;BR /&gt;Robert 8&lt;BR /&gt;Ronald 9&lt;BR /&gt;Thomas 9&lt;BR /&gt;Thomas 9&lt;BR /&gt;William 10&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 07 Jul 2024 09:06:17 GMT</pubDate>
    <dc:creator>pavank</dc:creator>
    <dc:date>2024-07-07T09:06:17Z</dc:date>
    <item>
      <title>seq number issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/seq-number-issue/m-p/934904#M367593</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
set sashelp.class;
if mod(_n_,2)=1 then seq=1;output;
else  mod(_n_,2)=0 then seq=1+1;

    output;
keep name seq;
proc print noobs;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;required output&lt;BR /&gt;Name Seq&lt;BR /&gt;Alfred 1&lt;BR /&gt;Alice 1&lt;BR /&gt;Alice 1&lt;BR /&gt;Barbara 2&lt;BR /&gt;Carol 2&lt;BR /&gt;Carol 2&lt;BR /&gt;Henry 3&lt;BR /&gt;James 3&lt;BR /&gt;James 3&lt;BR /&gt;Jane 4&lt;BR /&gt;Janet 4&lt;BR /&gt;Janet 4&lt;BR /&gt;Jeffrey 5&lt;BR /&gt;John 5&lt;BR /&gt;John 5&lt;BR /&gt;Joyce 6&lt;BR /&gt;Judy 6&lt;BR /&gt;Judy 6&lt;BR /&gt;Louise 7&lt;BR /&gt;Mary 7&lt;BR /&gt;Mary 7&lt;BR /&gt;Philip 8&lt;BR /&gt;Robert 8&lt;BR /&gt;Robert 8&lt;BR /&gt;Ronald 9&lt;BR /&gt;Thomas 9&lt;BR /&gt;Thomas 9&lt;BR /&gt;William 10&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jul 2024 09:06:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/seq-number-issue/m-p/934904#M367593</guid>
      <dc:creator>pavank</dc:creator>
      <dc:date>2024-07-07T09:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: seq number issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/seq-number-issue/m-p/934905#M367594</link>
      <description>&lt;P&gt;Making reasonable assumptions about what the input looks like, here's what I came up wth:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   if mod(_n_, 2) then do;  
      seq + 1;
      output;
   end;
   else do;
      output;
      output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you are usig a lot of the right tools, but definitely need to tweak the program to get the desired result.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jul 2024 09:58:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/seq-number-issue/m-p/934905#M367594</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-07-07T09:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: seq number issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/seq-number-issue/m-p/934907#M367595</link>
      <description>&lt;P&gt;Could you explain the desired output? It appears that you want Alfred once, Alice twice, Barbara once, Carol twice, and so on. What is the logic?&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jul 2024 10:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/seq-number-issue/m-p/934907#M367595</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-07T10:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: seq number issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/seq-number-issue/m-p/934911#M367596</link>
      <description>&lt;P&gt;I see you already have a solution.&amp;nbsp; Here's is an alternative that eschews DO groups:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  seq+mod(_n_,2);
  output;
  if mod(_n_,2)=0 then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Jul 2024 14:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/seq-number-issue/m-p/934911#M367596</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-07-07T14:44:40Z</dc:date>
    </item>
  </channel>
</rss>

