<?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: copy values down in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822061#M324581</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;should be done for each group(that is defined by x1,x2)&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then there will never be a copy forward, as all x2 values are unique within a x1 group, so all these groups consist of exactly one observation.&lt;/P&gt;
&lt;P&gt;Please review your post.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2022 13:58:39 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-07-07T13:58:39Z</dc:date>
    <item>
      <title>copy values down</title>
      <link>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822011#M324555</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I have&amp;nbsp; a data set with 4 columns.&lt;/P&gt;
&lt;P&gt;I need to copy the values of fields : X3 ,X4 down.&lt;/P&gt;
&lt;P&gt;It means that for x1=1111 :&lt;/P&gt;
&lt;P&gt;the values 1000,400 will copy down to 11 rows and values&amp;nbsp; 3000,8000&amp;nbsp;will copy down to 11 rows.&lt;/P&gt;
&lt;P&gt;In real life I&amp;nbsp; have a data set with millions of rows and this action should be done for each group(that is defined by x1,x2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have;
input X1 X2 X3 X4;
cards;
1111 2205 1000 4000
1111 2204 . .
1111 2203 . .
1111 2202 . .
1111 2201 . .
1111 2112 . .
1111 2111 . .
1111 2110 . .
1111 2109 . .
1111 2108 . .
1111 2107 . .
1111 2106 . .
1111 2205 3000 8000
1111 2204 . .
1111 2203 . .
1111 2202 . .
1111 2201 . .
1111 2112 . .
1111 2111 . .
1111 2110 . .
1111 2109 . .
1111 2108 . .
1111 2107 . .
1111 2106 . .&lt;BR /&gt;&lt;BR /&gt;2222 2205 7000 2700
2222 2204 . .
2222 2203 . .
2222 2202 . .
2222 2201 . .
2222 2112 . .
2222 2111 . .
2222 2110 . .
2222 2109 . .
2222 2108 . .
2222 2107 . .
2222 2106 . .
2222 2205 1500 5500
2222 2204 . .
2222 2203 . .
2222 2202 . .
2222 2201 . .
2222 2112 . .
2222 2111 . .
2222 2110 . .
2222 2109 . .
2222 2108 . .
2222 2107 . .
2222 2106 . .
;
run;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2022 10:08:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822011#M324555</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-07-07T10:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: copy values down</title>
      <link>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822018#M324560</link>
      <description>&lt;P&gt;Seems like a RETAIN statement is what you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have (rename=(x3=x3a x4=x4a));
    retain x3 x4;
    if not missing(x3a) then x3=x3a;
    if not missing(x4a) then x4=x4a;
    drop x3a x4a;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2022 10:37:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822018#M324560</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-07T10:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: copy values down</title>
      <link>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822019#M324561</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;data want;
	retain _x3 _x4;
	set have;

	if not missing(x3) and not missing(x4) then
		do;
			_x3=x3;
			_x4=x4;
		end;
	else
		do;
			x3=_x3;
			x4=_x4;
		end;
	drop _x3 _x4;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2022 10:41:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822019#M324561</guid>
      <dc:creator>AlexBennasar</dc:creator>
      <dc:date>2022-07-07T10:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: copy values down</title>
      <link>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822020#M324562</link>
      <description>&lt;P&gt;The line&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;1111 2106 . .2222 2205 7000 2700&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;seems to be not right.&lt;/P&gt;
&lt;P&gt;Similar problems have been asked and answered many times. What have you tried?&lt;/P&gt;
&lt;P&gt;If groups are defined by x1 and x2, which values do you expect for the second obs?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 10:40:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822020#M324562</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-07-07T10:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: copy values down</title>
      <link>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822038#M324574</link>
      <description>&lt;BR /&gt;data want;&lt;BR /&gt; update have(obs=0) have;&lt;BR /&gt; by x1;&lt;BR /&gt; output;&lt;BR /&gt;run;</description>
      <pubDate>Thu, 07 Jul 2022 11:44:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822038#M324574</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-07-07T11:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: copy values down</title>
      <link>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822061#M324581</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;should be done for each group(that is defined by x1,x2)&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then there will never be a copy forward, as all x2 values are unique within a x1 group, so all these groups consist of exactly one observation.&lt;/P&gt;
&lt;P&gt;Please review your post.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 13:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/copy-values-down/m-p/822061#M324581</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-07T13:58:39Z</dc:date>
    </item>
  </channel>
</rss>

