<?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: How to duplicate an observation for the same record ID? in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520618#M6720</link>
    <description>&lt;P&gt;After duplicating the values by record the missing data will be deleted., I can not do it before because I will lose the records of interest.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Dec 2018 23:12:01 GMT</pubDate>
    <dc:creator>emma19901</dc:creator>
    <dc:date>2018-12-11T23:12:01Z</dc:date>
    <item>
      <title>How to duplicate an observation for the same record ID?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520609#M6715</link>
      <description>&lt;P&gt;Hi, I am working with a dataset that collected some body measurements., I would like to duplicate the observation on the same row to do a pre-treatment and post-treatment analysis. For example, having 1.2 again for record one. This a large dataset and doing this by hand or if-then statements is near to impossible.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;record&lt;/TD&gt;&lt;TD&gt;measure A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 11 Dec 2018 22:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520609#M6715</guid>
      <dc:creator>emma19901</dc:creator>
      <dc:date>2018-12-11T22:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to duplicate an observation for the same record ID?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520610#M6716</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input record	measure_A;
cards;
1	1.2
1	.
2	1.3
2	1.3
3	.
3	.
;
data want;
update have(obs=0) have;
by record;
output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 22:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520610#M6716</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-11T22:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to duplicate an observation for the same record ID?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520613#M6717</link>
      <description>&lt;P&gt;What exactly do you want as output?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.3 filled down? What about&amp;nbsp;Record 3s? Are both missing there? Should they stay missing or take the previous value?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please show what you start with and what you want as output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/187617"&gt;@emma19901&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, I am working with a dataset that collected some body measurements., I would like to duplicate the observation on the same row to do a pre-treatment and post-treatment analysis. For example, having 1.2 again for record one. This a large dataset and doing this by hand or if-then statements is near to impossible.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;record&lt;/TD&gt;
&lt;TD&gt;measure A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1.2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;1.3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;1.3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 22:49:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520613#M6717</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-11T22:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to duplicate an observation for the same record ID?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520616#M6718</link>
      <description>&lt;P&gt;Is this what you are looking for ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set have;
	by record;
	retain measure_a_;
	if first.record then measure_a_=measure_a;

	if missing(measure_a) then measure_a=measure_a_;

	drop measure_a_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Dec 2018 22:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520616#M6718</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2018-12-11T22:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to duplicate an observation for the same record ID?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520617#M6719</link>
      <description>&lt;P&gt;Yes, but is not working&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 23:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520617#M6719</guid>
      <dc:creator>emma19901</dc:creator>
      <dc:date>2018-12-11T23:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to duplicate an observation for the same record ID?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520618#M6720</link>
      <description>&lt;P&gt;After duplicating the values by record the missing data will be deleted., I can not do it before because I will lose the records of interest.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 23:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520618#M6720</guid>
      <dc:creator>emma19901</dc:creator>
      <dc:date>2018-12-11T23:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to duplicate an observation for the same record ID?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520619#M6721</link>
      <description>&lt;P&gt;It's not quite clear what you're trying to do. You can use OUTPUT to control the writing of records to an output step. So assuming you want to duplicate every record without a measure_A value, this has two output statements, which gives you two records.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note the output statement causes implicit outputs to stop, so you have to explicitly specify when you want a record written to the data set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
if not missing(measure_A) then do;
output;output;
end;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/187617"&gt;@emma19901&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;After duplicating the values by record the missing data will be deleted., I can not do it before because I will lose the records of interest.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 23:15:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520619#M6721</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-11T23:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to duplicate an observation for the same record ID?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520620#M6722</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input record	measure_A;
cards;
1	1.2
1	.
2	1.3
2	1.3
3	.
3	.
;
data want;
update have(obs=0) have;
by record;
if measure_a&amp;gt;. then output;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Dec 2018 23:16:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520620#M6722</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-11T23:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to duplicate an observation for the same record ID?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520648#M6723</link>
      <description>How should your expected output look like ?</description>
      <pubDate>Wed, 12 Dec 2018 00:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520648#M6723</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2018-12-12T00:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to duplicate an observation for the same record ID?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520671#M6724</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/187617"&gt;@emma19901&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Help us help you.&amp;nbsp; Please show the layout of the desired result data.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 05:16:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-to-duplicate-an-observation-for-the-same-record-ID/m-p/520671#M6724</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-12-12T05:16:35Z</dc:date>
    </item>
  </channel>
</rss>

