<?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: Same Observation in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Same-Observation/m-p/825473#M35217</link>
    <description>&lt;P&gt;Here's a different approach.&amp;nbsp; It has a major advantage in that it fills in missings for all your variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   update have (obs=0) have;
   by id;
   output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the program remains short no matter how many variables you have.&amp;nbsp; The disadvantage:&amp;nbsp; you need a sorted data set for this to work.&amp;nbsp; Another consideration:&amp;nbsp; it requires extra work if you want to fill in missings for only some of your variables but not for others.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jul 2022 17:13:08 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2022-07-26T17:13:08Z</dc:date>
    <item>
      <title>Same Observation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Same-Observation/m-p/825441#M35214</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a dataset&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DOB&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp;Sarah&amp;nbsp; &amp;nbsp; 07/29/1970&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp;Sarah&amp;nbsp; &amp;nbsp; &amp;nbsp; 07/29/1970&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to fill the missing values and dataset which I have has 10000's ID's.&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DOB&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp;Sarah&amp;nbsp; &amp;nbsp; 07/29/1970&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp;Sarah&amp;nbsp; &amp;nbsp; &amp;nbsp;07/29/1970&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp;Sarah&amp;nbsp; &amp;nbsp; &amp;nbsp; 07/29/1970&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can I do this in SAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 13:59:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Same-Observation/m-p/825441#M35214</guid>
      <dc:creator>Smitha9</dc:creator>
      <dc:date>2022-07-26T13:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Same Observation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Same-Observation/m-p/825443#M35215</link>
      <description>&lt;P&gt;From now on,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/329198"&gt;@Smitha9&lt;/a&gt;&amp;nbsp;please provide data as &lt;FONT color="#FF0000"&gt;working&lt;/FONT&gt; SAS data step code, as I show here. Please test your code to confirm that it actually works. What you have provided is not SAS data step code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID  Name $8. DOB :anydtdte.;
infile cards missover;
cards;
1   Sarah    07/29/1970
1                
1   Sarah    07/29/1970
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my solution&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    retain name1 dob1;
    if not missing(name) then name1=name;
    if not missing(dob) then dob1=dob;
    drop name dob;
    format dob1 mmddyy10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 14:09:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Same-Observation/m-p/825443#M35215</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-26T14:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Same Observation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Same-Observation/m-p/825466#M35216</link>
      <description>&lt;P&gt;It seems that one also needs to take ID into account:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Name :$8. DOB :mmddyy10.;
format dob yymmdd10.;
infile cards missover;
cards;
1 Sarah 07/29/1970
1  .
1 Sarah 07/29/1970
;

data want;
set have;
by id;
retain _name _dob;
if first.id or not missing(name)
then _name = name;
else name = _name;
if first.id or not missing(dob)
then _dob = dob;
else dob = _dob;
drop _dob _name;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jul 2022 16:59:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Same-Observation/m-p/825466#M35216</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-26T16:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Same Observation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Same-Observation/m-p/825473#M35217</link>
      <description>&lt;P&gt;Here's a different approach.&amp;nbsp; It has a major advantage in that it fills in missings for all your variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   update have (obs=0) have;
   by id;
   output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the program remains short no matter how many variables you have.&amp;nbsp; The disadvantage:&amp;nbsp; you need a sorted data set for this to work.&amp;nbsp; Another consideration:&amp;nbsp; it requires extra work if you want to fill in missings for only some of your variables but not for others.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 17:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Same-Observation/m-p/825473#M35217</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-07-26T17:13:08Z</dc:date>
    </item>
  </channel>
</rss>

