<?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: Create a new variable that increases by one every third observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-increases-by-one-every-third/m-p/602461#M174444</link>
    <description>&lt;P&gt;thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 07 Nov 2019 16:04:11 GMT</pubDate>
    <dc:creator>Hess</dc:creator>
    <dc:date>2019-11-07T16:04:11Z</dc:date>
    <item>
      <title>Create a new variable that increases by one every third observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-increases-by-one-every-third/m-p/602446#M174439</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to create a new variable that increases by 1 every third observation.&amp;nbsp; I'm pasting the simple formula from excel below.&amp;nbsp; Is there a way to replicate this in SAS, so that it will create several million rows in this fashion?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 118px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33750iE111DC0F2C45CDF5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.JPG" style="width: 202px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33751i7C721A7CF83589B4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.JPG" alt="Capture2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 15:51:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-increases-by-one-every-third/m-p/602446#M174439</guid>
      <dc:creator>Hess</dc:creator>
      <dc:date>2019-11-07T15:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that increases by one every third observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-increases-by-one-every-third/m-p/602452#M174440</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    newvariable = ceil(_n_/3);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The CEIL() function rounds the value inside the parenthesis up to the next integer, so rows 1 2 and 3 will round up to a 1; and so on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Advice ... stop thinking about how to do it in Excel, as this likely will not help in SAS. I know this is difficult to do if you are a beginner in SAS, but the advice will help you in the long run.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 16:10:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-increases-by-one-every-third/m-p/602452#M174440</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-11-07T16:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that increases by one every third observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-increases-by-one-every-third/m-p/602454#M174441</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/180809"&gt;@Hess&lt;/a&gt;&amp;nbsp;Hi and welcome to the SAS Community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you looking for something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   do _N_=1 to 10;
      if mod(_N_, 3)=1 then a+1;
      output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Nov 2019 15:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-increases-by-one-every-third/m-p/602454#M174441</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-07T15:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that increases by one every third observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-increases-by-one-every-third/m-p/602461#M174444</link>
      <description>&lt;P&gt;thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 16:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-increases-by-one-every-third/m-p/602461#M174444</guid>
      <dc:creator>Hess</dc:creator>
      <dc:date>2019-11-07T16:04:11Z</dc:date>
    </item>
  </channel>
</rss>

