<?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: Generate incremental data based on a pattern in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Generate-incremental-data-based-on-a-pattern/m-p/44825#M11829</link>
    <description>Inlcude do loop and Output statment. Where i is how many times you want to increment the value. See the bleow code. Let me know if it deosn't solve your purpose.&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
num=1;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data test1;&lt;BR /&gt;
set test;&lt;BR /&gt;
by num;&lt;BR /&gt;
retain count 0;&lt;BR /&gt;
if first.num then count=0;&lt;BR /&gt;
do i=1 to 5;&lt;BR /&gt;
count=count+2;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
~ Sukanya E</description>
    <pubDate>Mon, 15 Jun 2009 20:22:47 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-06-15T20:22:47Z</dc:date>
    <item>
      <title>Generate incremental data based on a pattern</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Generate-incremental-data-based-on-a-pattern/m-p/44824#M11828</link>
      <description>I'm trying to generate incremental data in a dataset based on a pattern.&lt;BR /&gt;
For example I have a dataset with only 1 field and 1 record with value =2 and I want it to increment by 2 without replacing the old one.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Initial dataset: &lt;BR /&gt;
-------------&lt;BR /&gt;
count&lt;BR /&gt;
2&lt;BR /&gt;
&lt;BR /&gt;
My goal:&lt;BR /&gt;
----------&lt;BR /&gt;
2&lt;BR /&gt;
4&lt;BR /&gt;
6&lt;BR /&gt;
8&lt;BR /&gt;
10&lt;BR /&gt;
&lt;BR /&gt;
The problem I am having is , when I write the code to generate the pattern, the new value (incremented ) replaces the old value so I only get 1 record.&lt;BR /&gt;
&lt;BR /&gt;
Here's my code&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
num=1;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data test1;&lt;BR /&gt;
set test;&lt;BR /&gt;
by num;&lt;BR /&gt;
retain count 0;&lt;BR /&gt;
if first.num then do;&lt;BR /&gt;
count=count+2;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Once I get the code right, I will be replicating it to generate datetime fields from May 20 1980 to June 6 2008, with dates at 6 hours intervals captured one below the other in the dataset.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.

Message was edited by: osho</description>
      <pubDate>Mon, 15 Jun 2009 19:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Generate-incremental-data-based-on-a-pattern/m-p/44824#M11828</guid>
      <dc:creator>osho</dc:creator>
      <dc:date>2009-06-15T19:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Generate incremental data based on a pattern</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Generate-incremental-data-based-on-a-pattern/m-p/44825#M11829</link>
      <description>Inlcude do loop and Output statment. Where i is how many times you want to increment the value. See the bleow code. Let me know if it deosn't solve your purpose.&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
num=1;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data test1;&lt;BR /&gt;
set test;&lt;BR /&gt;
by num;&lt;BR /&gt;
retain count 0;&lt;BR /&gt;
if first.num then count=0;&lt;BR /&gt;
do i=1 to 5;&lt;BR /&gt;
count=count+2;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
~ Sukanya E</description>
      <pubDate>Mon, 15 Jun 2009 20:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Generate-incremental-data-based-on-a-pattern/m-p/44825#M11829</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-06-15T20:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Generate incremental data based on a pattern</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Generate-incremental-data-based-on-a-pattern/m-p/44826#M11830</link>
      <description>It worked.&lt;BR /&gt;
Thank you Sukanya.</description>
      <pubDate>Mon, 15 Jun 2009 20:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Generate-incremental-data-based-on-a-pattern/m-p/44826#M11830</guid>
      <dc:creator>osho</dc:creator>
      <dc:date>2009-06-15T20:27:54Z</dc:date>
    </item>
  </channel>
</rss>

