<?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 prevent sas from filling missing data with the wrong column data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465865#M118835</link>
    <description>&lt;P&gt;Thank you! So far I've gotten the best results with this method.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 May 2018 23:37:17 GMT</pubDate>
    <dc:creator>Errant</dc:creator>
    <dc:date>2018-05-29T23:37:17Z</dc:date>
    <item>
      <title>How to prevent sas from filling missing data with the wrong column data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465840#M118824</link>
      <description>&lt;P&gt;Hi y'all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a raw dataset that represents hotel transactions. The yes/no column represents if a customer used the internet and the following numeric column represents days of internet use.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="HotelRaw.PNG" style="width: 574px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20833iFA12C1174318CB8E/image-size/large?v=v2&amp;amp;px=999" role="button" title="HotelRaw.PNG" alt="HotelRaw.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this code to input the data:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Data HotelA;
Infile 'C:\user\hotel.dat' missover;
Input 
room_number 
guest_number 
month_in 
day_in 
year_in 
month_out 
day_out 
year_out 
Internet_use $ 
Days_internet 
room_type &amp;amp; :$14.
Room_rate;
proc print data = HotelA;
Run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this code I get this output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hotelout.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20835i0648CB1C6B76657C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Hotelout.PNG" alt="Hotelout.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, when there is no value for days of internet use, it starts pulling data from the following column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not pulling data from the wrong line, it's just pulling it from the wrong column in the same observation. I've tried using an if-then statement to exclude the numeric values, but it didn't resolve the underlying problem.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;If room_type&amp;gt;0 then room_type = ' ';&lt;/PRE&gt;&lt;P&gt;I also tried truncover instead of missover and that somehow looked uglier with the same issue. How do you stop sas from filling in missing data with other columnar data within the same observation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time/help!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- D.&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 21:24:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465840#M118824</guid>
      <dc:creator>Errant</dc:creator>
      <dc:date>2018-05-29T21:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to prevent sas from filling missing data with the wrong column data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465845#M118827</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Internet_use :$3.&lt;/P&gt;
&lt;P&gt;days_internet 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in your input statement.&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 21:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465845#M118827</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-05-29T21:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to prevent sas from filling missing data with the wrong column data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465858#M118832</link>
      <description>Try adding the DSD option. This assumes that you have an extra blank space if you have an empty value. If you don't have an empty space, how is a missing value identified?</description>
      <pubDate>Tue, 29 May 2018 22:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465858#M118832</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-29T22:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to prevent sas from filling missing data with the wrong column data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465859#M118833</link>
      <description>&lt;P&gt;If at all possible, you need a more rigorous INPUT statement ... one that tells SAS where to find the values.&amp;nbsp; For example, you might begin with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Input 
room_number    1-3
guest_number     4
month_in       6-7
day_in        9-10&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually tell SAS which columns of the incoming file to read, to find each variable.&amp;nbsp; The column numbers in this example are made up, because I can't actually see the incoming data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can post a few lines of the incoming data, it would help get a better answer.&amp;nbsp; Without that, you can try improving the current INPUT statement by changing one line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Days_internet 3.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dot at the end signifies that these are instructions ("read the next 3 characters") rather than the specific columns to be read.&amp;nbsp; For it to get the right result, there have to be blanks in the data where DAYS_INTERNET would have appeared.&amp;nbsp; At any rate, post a few lines of data to get a better answer.&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 22:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465859#M118833</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-29T22:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to prevent sas from filling missing data with the wrong column data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465865#M118835</link>
      <description>&lt;P&gt;Thank you! So far I've gotten the best results with this method.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 23:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-prevent-sas-from-filling-missing-data-with-the-wrong/m-p/465865#M118835</guid>
      <dc:creator>Errant</dc:creator>
      <dc:date>2018-05-29T23:37:17Z</dc:date>
    </item>
  </channel>
</rss>

