<?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 How do I make one observation's value of a variable all of the values of that variable by group? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879682#M347527</link>
    <description>&lt;P&gt;data example;&lt;BR /&gt;input $record_id education mother;&lt;BR /&gt;datalines;&lt;BR /&gt;1 2 1&lt;BR /&gt;1 . 0&lt;BR /&gt;1 1 0&lt;BR /&gt;1 . 0&lt;BR /&gt;2 . 0&lt;BR /&gt;2 3 1&lt;BR /&gt;3 4 1&lt;BR /&gt;3 . 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;*I want it to look like this;&lt;BR /&gt;data example;&lt;BR /&gt;input $record_id education mother;&lt;BR /&gt;datalines;&lt;BR /&gt;1 2 1&lt;BR /&gt;1 2 0&lt;BR /&gt;1 2 0&lt;BR /&gt;1 2 0&lt;BR /&gt;2 3 1&lt;BR /&gt;2 3 0&lt;BR /&gt;3 4 1&lt;BR /&gt;3 4 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jun 2023 03:11:02 GMT</pubDate>
    <dc:creator>mbayer</dc:creator>
    <dc:date>2023-06-08T03:11:02Z</dc:date>
    <item>
      <title>How do I make one observation's value of a variable all of the values of that variable by group?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879682#M347527</link>
      <description>&lt;P&gt;data example;&lt;BR /&gt;input $record_id education mother;&lt;BR /&gt;datalines;&lt;BR /&gt;1 2 1&lt;BR /&gt;1 . 0&lt;BR /&gt;1 1 0&lt;BR /&gt;1 . 0&lt;BR /&gt;2 . 0&lt;BR /&gt;2 3 1&lt;BR /&gt;3 4 1&lt;BR /&gt;3 . 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;*I want it to look like this;&lt;BR /&gt;data example;&lt;BR /&gt;input $record_id education mother;&lt;BR /&gt;datalines;&lt;BR /&gt;1 2 1&lt;BR /&gt;1 2 0&lt;BR /&gt;1 2 0&lt;BR /&gt;1 2 0&lt;BR /&gt;2 3 1&lt;BR /&gt;2 3 0&lt;BR /&gt;3 4 1&lt;BR /&gt;3 4 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 03:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879682#M347527</guid>
      <dc:creator>mbayer</dc:creator>
      <dc:date>2023-06-08T03:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make one observation's value of a variable all of the values of that variable by group?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879686#M347529</link>
      <description>&lt;P&gt;So you want the max of education to carry over to all other observations for the same record_id?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 03:49:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879686#M347529</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-08T03:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make one observation's value of a variable all of the values of that variable by group?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879687#M347530</link>
      <description>&lt;P&gt;Close! I want the education value for the observations where mother = 1 to carry over for all the other observations with the same record _id. It isn't always the max value or the first value (within that record_id).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 03:54:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879687#M347530</guid>
      <dc:creator>mbayer</dc:creator>
      <dc:date>2023-06-08T03:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make one observation's value of a variable all of the values of that variable by group?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879688#M347531</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
do until (last.record_id);
  set have;
  by record_id;
  if mother = 1 then _ed = education;
end;
do until (last.record_id);
  set have;
  by record_id;
  education = _ed;
  output;
end;
drop _ed;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Jun 2023 04:07:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879688#M347531</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-08T04:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make one observation's value of a variable all of the values of that variable by group?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879689#M347532</link>
      <description>&lt;P&gt;Here's an SQL-based approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
input record_id $ education mother;
datalines;
1 2 1
1 . 0
1 1 0
1 . 0
2 . 0
2 3 1
3 4 1
3 . 0
;
run;

proc sql;
  create table want as
  select A.record_id
        ,B.education_max
	    ,A.mother
  from example as A
  left join
  (select record_id
         ,max(education) as education_max
   from example
   where mother = 1
   group by record_id
  ) as B
  on A.record_id = B.record_id
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Jun 2023 04:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879689#M347532</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-06-08T04:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I make one observation's value of a variable all of the values of that variable by group?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879690#M347533</link>
      <description>&lt;P&gt;That was amazing! Thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 04:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-make-one-observation-s-value-of-a-variable-all-of-the/m-p/879690#M347533</guid>
      <dc:creator>mbayer</dc:creator>
      <dc:date>2023-06-08T04:17:12Z</dc:date>
    </item>
  </channel>
</rss>

