<?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 Duplicate Observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185646#M35222</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to duplicate an observation while a condition is not true.&amp;nbsp; I want to duplicate esiid1 when the value in recorder does not equal 1.&amp;nbsp; Here's my latest attempt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;data esiid3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set recorder;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; Do while (recorder ne 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output esiid1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Oct 2014 17:57:29 GMT</pubDate>
    <dc:creator>BU2B</dc:creator>
    <dc:date>2014-10-15T17:57:29Z</dc:date>
    <item>
      <title>Duplicate Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185646#M35222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to duplicate an observation while a condition is not true.&amp;nbsp; I want to duplicate esiid1 when the value in recorder does not equal 1.&amp;nbsp; Here's my latest attempt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;data esiid3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set recorder;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; Do while (recorder ne 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output esiid1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 17:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185646#M35222</guid>
      <dc:creator>BU2B</dc:creator>
      <dc:date>2014-10-15T17:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185647#M35223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Without any data, either what you have or need we're throwing darts in the dark:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #000080;"&gt;data esiid3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #000080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set recorder;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;if recorder ne 1 then output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;output;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 17:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185647#M35223</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-10-15T17:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185648#M35224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need the value in esiid1 to duplicate until it encounters the next esiid1 where the recorder = 1.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="esiid.JPG" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/7613_esiid.JPG" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 18:30:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185648#M35224</guid>
      <dc:creator>BU2B</dc:creator>
      <dc:date>2014-10-15T18:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185649#M35225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like this may generate desired output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data esiid3;&lt;/P&gt;&lt;P&gt;set recorder;&lt;/P&gt;&lt;P&gt;retain esiid1;&lt;/P&gt;&lt;P&gt;if recorder = 1 then esiid1=ESIID;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 19:02:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185649#M35225</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-10-15T19:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185650#M35226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, no that just output a data set that matches the input set recorder.&amp;nbsp; I think retain is on the right path though!&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 19:18:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185650#M35226</guid>
      <dc:creator>BU2B</dc:creator>
      <dc:date>2014-10-15T19:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185651#M35227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;recorder is a character variable (leading zeros), newrecorder is numeric so you're code would have to change according but I think @stat@Sas code would work otherwise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data esiid3;&lt;/P&gt;&lt;P&gt;set recorder;&lt;/P&gt;&lt;P&gt;retain esiid1;&lt;/P&gt;&lt;P&gt;if newrecorder = 1 then esiid1=ESIID;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 19:29:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185651#M35227</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-10-15T19:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185652#M35228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Doh!&amp;nbsp; Sorry my bad on the newrecorder!&amp;nbsp; I still can't get the desired dataset though.&amp;nbsp; I'll play with it more Monday.&amp;nbsp; I'm out for a 4 day weekend!&amp;nbsp; Thanks for all the help folks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 20:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185652#M35228</guid>
      <dc:creator>BU2B</dc:creator>
      <dc:date>2014-10-15T20:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185653#M35229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be you can try this after weekend. Have a great long weekend!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;set recorder;&lt;BR /&gt;if recorder=1 then grp+1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data esiid3 (drop=esiid1 grp rename=esiid2=esiid1);&lt;BR /&gt;set have;&lt;BR /&gt;by grp;&lt;BR /&gt;retain esiid2;&lt;BR /&gt;if first.grp then esiid2=esiid1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=esiid3;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 20:36:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185653#M35229</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-10-15T20:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185654#M35230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well that did the trick!&amp;nbsp; Thanks so much!&amp;nbsp; Have a good weekend!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 20:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-Observation/m-p/185654#M35230</guid>
      <dc:creator>BU2B</dc:creator>
      <dc:date>2014-10-15T20:45:14Z</dc:date>
    </item>
  </channel>
</rss>

