<?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 add missing hours into SAS file? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/566000#M159005</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;We know that there are 150 houses per zone.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;So houses are labeled 0 to 150 and how many zones do you have?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Probably the simplest&amp;nbsp;way is to build an empty table and merge into it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data skeleton;
do zone=1 to 200;
do house=1 to 150;
output;
end;
end;
run;

data want;
merge skeleton have;
by zone house;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;A bunch of other options are outlined in this document, some are easier, some are harder.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://www.lexjansen.com/pharmasug/2005/CodersCorner/cc22.pdf" target="_blank"&gt;https://www.lexjansen.com/pharmasug/2005/CodersCorner/cc22.pdf&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2019 19:48:27 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-06-13T19:48:27Z</dc:date>
    <item>
      <title>How to add missing hours into SAS file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/565987#M158995</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a SAS file of 200 zones. In each zone, there are 150 houses. I then have a binary event variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not have info on all the houses but need to fill in the missing values and put event= '.'&lt;/P&gt;&lt;P&gt;Like for zone 0, I am missing house 4,5,6,7, the values between 8-30, etc. Is there a way I can add these missing values for each of the zones in SAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this question makes sense!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the picture is how it looks now:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="thumbnail_Screen Shot 2019-06-13 at 3.20.41 PM.png" style="width: 462px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30266i6CF5981E7FEEDCBC/image-size/large?v=v2&amp;amp;px=999" role="button" title="thumbnail_Screen Shot 2019-06-13 at 3.20.41 PM.png" alt="thumbnail_Screen Shot 2019-06-13 at 3.20.41 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 19:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/565987#M158995</guid>
      <dc:creator>CMepistudent</dc:creator>
      <dc:date>2019-06-13T19:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to add missing hours into SAS file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/565990#M158997</link>
      <description>Sure, but you need to have the infomration somewhere? Does it exist elsewhere in a different data set? How do you know which values are missing besides obvious sequential order? For example,should 90 to 101 be present for zone 2?&lt;BR /&gt;&lt;BR /&gt;There's a CLASSDATA option in PROC MEANS that helps with setting this up.&lt;BR /&gt;&lt;BR /&gt;We can't really help from images though, unless we type out your data. If you need help with code please take the time to paste your data as text and also show your expected output.</description>
      <pubDate>Thu, 13 Jun 2019 19:37:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/565990#M158997</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-13T19:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to add missing hours into SAS file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/565996#M159002</link>
      <description>&lt;P&gt;I already have this file imported into SAS.&lt;/P&gt;&lt;P&gt;We know that there are 150 houses per zone. So for the houses with missing info: I need it to say zone 0, hour 4, accident "." (to indicate that it's missing).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have information for a lot of the houses, but need to indicate missing for the ones that aren't listed in the file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 19:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/565996#M159002</guid>
      <dc:creator>CMepistudent</dc:creator>
      <dc:date>2019-06-13T19:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to add missing hours into SAS file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/565997#M159003</link>
      <description>&lt;P&gt;Can't do any testing with a picture.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 19:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/565997#M159003</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-06-13T19:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to add missing hours into SAS file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/566000#M159005</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;We know that there are 150 houses per zone.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;So houses are labeled 0 to 150 and how many zones do you have?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Probably the simplest&amp;nbsp;way is to build an empty table and merge into it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data skeleton;
do zone=1 to 200;
do house=1 to 150;
output;
end;
end;
run;

data want;
merge skeleton have;
by zone house;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;A bunch of other options are outlined in this document, some are easier, some are harder.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://www.lexjansen.com/pharmasug/2005/CodersCorner/cc22.pdf" target="_blank"&gt;https://www.lexjansen.com/pharmasug/2005/CodersCorner/cc22.pdf&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 19:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/566000#M159005</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-13T19:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to add missing hours into SAS file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/566026#M159018</link>
      <description>&lt;P&gt;Thank you! I appreciate it!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 20:22:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-missing-hours-into-SAS-file/m-p/566026#M159018</guid>
      <dc:creator>CMepistudent</dc:creator>
      <dc:date>2019-06-13T20:22:05Z</dc:date>
    </item>
  </channel>
</rss>

