<?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 get check in and check out days and then difference of these date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303425#M64450</link>
    <description>&lt;P&gt;I don't understand your remaining questions. You'll have to rephrase them and provide examples&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the following should work based on the assumption your data is being read in correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data format;

set hotel;

checkin=mdy(IM,ID,IY);
checkout=mdy(OM,OD,OY);

format checkin checkout date9. ;

days=checkout-checkin;

run;

proc print data=format;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If this doesn't work,, post the exact code you submit AND the log with the errors.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 09 Oct 2016 05:33:02 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-10-09T05:33:02Z</dc:date>
    <item>
      <title>how to get check in and check out days and then difference of these date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303395#M64435</link>
      <description>&lt;P&gt;I have to make checkin&amp;nbsp;and check out&amp;nbsp;columns from IM&lt;SPAN&gt;&amp;nbsp;ID IY and OM OD OY columns , and then find the days of stay by subtracting checkout - checkin , but could not get the results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data hotel;&lt;BR /&gt;INFILE 'hotel.dat';&lt;BR /&gt;INPUT Room Guests IM ID IY OM OD OY ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data format;&lt;BR /&gt;length checkin $20 checkout $20;&lt;BR /&gt;set hotel;&lt;BR /&gt;checkin=mdy(IM,ID,IY);&lt;BR /&gt;checkout=mdy(OM,OD,OY);&lt;BR /&gt;format checkin checkout mdy;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data format;&lt;BR /&gt;length days;&lt;BR /&gt;days=checkout-checkin;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=format;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not able to formate checkin and checkout as dates , so that i can get a new variable daydiff&amp;nbsp;from checkin and checkout days.&lt;/P&gt;&lt;P&gt;Hope to hear soon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2016 23:28:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303395#M64435</guid>
      <dc:creator>azee007</dc:creator>
      <dc:date>2016-10-08T23:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to get check in and check out days and then difference of these date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303398#M64438</link>
      <description>&lt;P&gt;You should be getting errors? Your format statement is incorrect. I suggest using a date9 format instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure you have a clean log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You second data step is missing a SET statement so it has no input dataset to process. You don't need two steps though, just use one.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2016 23:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303398#M64438</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-08T23:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to get check in and check out days and then difference of these date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303418#M64444</link>
      <description>&lt;P&gt;Also, the statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#800000"&gt;&lt;STRONG&gt;length checkin $20 checkout $20;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;declares the two variables as character strings. But SAS dates returned by function MDY are numbers. Remove the length statement and SAS will understand that checkin and checkout are numbers.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2016 03:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303418#M64444</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-10-09T03:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to get check in and check out days and then difference of these date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303422#M64447</link>
      <description>&lt;P&gt;I have tried&amp;nbsp;date9 , but it is not running and giving errors . I have also&amp;nbsp;tried mmddyy10. , that also doesn't&amp;nbsp;work, i have used date10. , that also doesn't&amp;nbsp;work . Please tell me in code where i have to use date9 ..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also,i need to know that if i have guests who are 1 or more than 1 in numbers like 2,3 , 5 ,8. I need to multiply with room&amp;nbsp;rate and guests more than 1 ( where 1 guest is free) and above 1 guest its $10 per guest. I am not able to make code.Plz help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2016 04:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303422#M64447</guid>
      <dc:creator>azee007</dc:creator>
      <dc:date>2016-10-09T04:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to get check in and check out days and then difference of these date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303425#M64450</link>
      <description>&lt;P&gt;I don't understand your remaining questions. You'll have to rephrase them and provide examples&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the following should work based on the assumption your data is being read in correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data format;

set hotel;

checkin=mdy(IM,ID,IY);
checkout=mdy(OM,OD,OY);

format checkin checkout date9. ;

days=checkout-checkin;

run;

proc print data=format;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If this doesn't work,, post the exact code you submit AND the log with the errors.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2016 05:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303425#M64450</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-09T05:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to get check in and check out days and then difference of these date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303426#M64451</link>
      <description>&lt;P&gt;Yes , it worked . But as i was using the other format is got the answer , but now its much better format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2016 05:39:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303426#M64451</guid>
      <dc:creator>azee007</dc:creator>
      <dc:date>2016-10-09T05:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to get check in and check out days and then difference of these date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303429#M64454</link>
      <description>&lt;P&gt;Make sure your days are correct with hotel definition.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're doing stragiht subtraction there, which is number of nights booked. The number of days is often +1 in travel speak, or 6 night/7-day trip.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2016 06:18:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-check-in-and-check-out-days-and-then-difference-of/m-p/303429#M64454</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-09T06:18:13Z</dc:date>
    </item>
  </channel>
</rss>

