<?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: data manipulation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/694177#M211692</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(drop=s);
   merge temp1 temp2;
   by class teacher;
   if score then s = score;
   retain s;
   if score = . then score = s;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;teacher class score weight 
A       C1    70    . 
A       C2    80    0.500 
B       C2    80    0.500 
B       C3    90    0.333 
C       C3    90    0.333 
D       C3    90    0.333 
B       C4    99    . 
C       C5    76    . 
D       C6    95    . 
&lt;/PRE&gt;</description>
    <pubDate>Mon, 26 Oct 2020 08:05:27 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2020-10-26T08:05:27Z</dc:date>
    <item>
      <title>data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/694171#M211689</link>
      <description>&lt;P&gt;data temp1;&lt;BR /&gt;input teacher $ class $ score;&lt;BR /&gt;cards;&lt;BR /&gt;A C1 70&lt;BR /&gt;A C2 80&lt;BR /&gt;B C3 90&lt;BR /&gt;B C4 99&lt;BR /&gt;C C5 76&lt;BR /&gt;D C6 95&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data temp2;&lt;BR /&gt;input teacher $ class $ weight ;&lt;BR /&gt;cards;&lt;BR /&gt;A C2 0.5&lt;BR /&gt;B C2 0.5&lt;BR /&gt;B C3 0.333&lt;BR /&gt;C C3 0.333&lt;BR /&gt;D C3 0.333&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;from temp1,Class C1, C4, C5 and C6 are taught independently by teacher A , B, C and respectively.&lt;/P&gt;&lt;P&gt;from temp2, Class C2 is co-taught by teacher A and B (weight 0.5 each), but data temp1 only has A's data not B's.&lt;/P&gt;&lt;P&gt;Class C3 is co-taught by teacher B, C, and D (weight 0.3333 each), again but data temp1 only has B's data not C D.&lt;/P&gt;&lt;P&gt;I wan to create a new data set to copy the co-teach (class and score) information as follows: variables are teacher class score and weight(only co-taught courses have weights)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;A C1 70 .&lt;BR /&gt;A C2 80 0.5&lt;BR /&gt;B C2 80 0.5&lt;BR /&gt;B C3 90 0.333&lt;BR /&gt;C C3 90 0.333&lt;BR /&gt;D C3 90 0.333&lt;BR /&gt;B C4 99 .&lt;BR /&gt;C C5 76 .&amp;nbsp;&lt;BR /&gt;D C6 95 .&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 07:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/694171#M211689</guid>
      <dc:creator>tinghlin</dc:creator>
      <dc:date>2020-10-26T07:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/694177#M211692</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(drop=s);
   merge temp1 temp2;
   by class teacher;
   if score then s = score;
   retain s;
   if score = . then score = s;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;teacher class score weight 
A       C1    70    . 
A       C2    80    0.500 
B       C2    80    0.500 
B       C3    90    0.333 
C       C3    90    0.333 
D       C3    90    0.333 
B       C4    99    . 
C       C5    76    . 
D       C6    95    . 
&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Oct 2020 08:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/694177#M211692</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-10-26T08:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/694180#M211693</link>
      <description>&lt;P&gt;Simpler:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   merge temp1 temp2;
   by class teacher;
   if score then _iorc_ = score;
   else score = _iorc_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Oct 2020 08:18:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/data-manipulation/m-p/694180#M211693</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-10-26T08:18:46Z</dc:date>
    </item>
  </channel>
</rss>

