<?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: DATE ERROR IN IF STATEMENT in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704281#M26118</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/130051"&gt;@archita&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;/&lt;/P&gt;
&lt;P&gt;I am merging two datsets by week starting from 2020106 and ending 20201023. how do i use it in if statement?&lt;/P&gt;
&lt;P&gt;data combined;&lt;/P&gt;
&lt;P&gt;merge a(in=in1) b(in=in2);&lt;/P&gt;
&lt;P&gt;by week_date;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if in1 and in2 and week_date &amp;gt;=20201016 and week_date &amp;lt;20201023;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you get an error? If so what?&amp;nbsp; Or did it not work? If so how do you know?&lt;/P&gt;
&lt;P&gt;How is the variable WEEK_DATE defined in each of those two datasets?&amp;nbsp; Your code is assuming it is a number with values like 20,201,016.&amp;nbsp; I human might think a number like that could mean the 16th of November of the year 2020.&lt;/P&gt;
&lt;P&gt;But if your variable is character then values need quotes.&amp;nbsp; Such as '20201016'.&lt;/P&gt;
&lt;P&gt;And if the variable has date values (you can tell because it will have a date type format attached to, such as the YYMMDDN8. format that would make the values look like the numbers you typed in your code.&amp;nbsp; In that case you need to use date literals that have values that the DATE informat can interpret.&amp;nbsp; Such as '16NOV2020'd.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Dec 2020 21:02:02 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-12-07T21:02:02Z</dc:date>
    <item>
      <title>DATE ERROR IN IF STATEMENT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704279#M26117</link>
      <description>&lt;P&gt;/&lt;/P&gt;&lt;P&gt;I am merging two datsets by week starting from 2020106 and ending 20201023. how do i use it in if statement?&lt;/P&gt;&lt;P&gt;data combined;&lt;/P&gt;&lt;P&gt;merge a(in=in1) b(in=in2);&lt;/P&gt;&lt;P&gt;by week_date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if in1 and in2 and week_date &amp;gt;=20201016 and week_date &amp;lt;20201023;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 20:49:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704279#M26117</guid>
      <dc:creator>archita</dc:creator>
      <dc:date>2020-12-07T20:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: DATE ERROR IN IF STATEMENT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704281#M26118</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/130051"&gt;@archita&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;/&lt;/P&gt;
&lt;P&gt;I am merging two datsets by week starting from 2020106 and ending 20201023. how do i use it in if statement?&lt;/P&gt;
&lt;P&gt;data combined;&lt;/P&gt;
&lt;P&gt;merge a(in=in1) b(in=in2);&lt;/P&gt;
&lt;P&gt;by week_date;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if in1 and in2 and week_date &amp;gt;=20201016 and week_date &amp;lt;20201023;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you get an error? If so what?&amp;nbsp; Or did it not work? If so how do you know?&lt;/P&gt;
&lt;P&gt;How is the variable WEEK_DATE defined in each of those two datasets?&amp;nbsp; Your code is assuming it is a number with values like 20,201,016.&amp;nbsp; I human might think a number like that could mean the 16th of November of the year 2020.&lt;/P&gt;
&lt;P&gt;But if your variable is character then values need quotes.&amp;nbsp; Such as '20201016'.&lt;/P&gt;
&lt;P&gt;And if the variable has date values (you can tell because it will have a date type format attached to, such as the YYMMDDN8. format that would make the values look like the numbers you typed in your code.&amp;nbsp; In that case you need to use date literals that have values that the DATE informat can interpret.&amp;nbsp; Such as '16NOV2020'd.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 21:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704281#M26118</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-07T21:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: DATE ERROR IN IF STATEMENT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704355#M26126</link>
      <description>&lt;P&gt;All depends on how the dates are stored in your datasets. If they are not sas-dates, but strings or just numbers, fix that problem before you continue with merging.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 06:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704355#M26126</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-12-08T06:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: DATE ERROR IN IF STATEMENT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704389#M26130</link>
      <description>&lt;P&gt;If that code does not throw an ERROR or a WARNING, but returns zero observations, then it is very likely that you have SAS date values in week_date, which are in the 5-digit range for all current dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, we need to see the log as is for diagnostics. And run a PROC CONTENTS on the dataset and post the result, so we can get an idea about your week_date variable.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 11:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704389#M26130</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-08T11:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: DATE ERROR IN IF STATEMENT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704645#M26166</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/130051"&gt;@archita&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;/&lt;/P&gt;
&lt;P&gt;I am merging two datsets by week starting from 2020106 and ending 20201023. how do i use it in if statement?&lt;/P&gt;
&lt;P&gt;data combined;&lt;/P&gt;
&lt;P&gt;merge a(in=in1) b(in=in2);&lt;/P&gt;
&lt;P&gt;by week_date;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if in1 and in2 and week_date &amp;gt;=20201016 and week_date &amp;lt;20201023;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Number values in the range of 20201016 would be past the year 20,000 and outside the range of currently valid SAS dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt; has a PDF with much information about dates.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 07:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704645#M26166</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-09T07:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: DATE ERROR IN IF STATEMENT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704646#M26167</link>
      <description>Thank you</description>
      <pubDate>Wed, 09 Dec 2020 07:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704646#M26167</guid>
      <dc:creator>archita</dc:creator>
      <dc:date>2020-12-09T07:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: DATE ERROR IN IF STATEMENT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704647#M26168</link>
      <description>Thank you all</description>
      <pubDate>Wed, 09 Dec 2020 07:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/DATE-ERROR-IN-IF-STATEMENT/m-p/704647#M26168</guid>
      <dc:creator>archita</dc:creator>
      <dc:date>2020-12-09T07:30:49Z</dc:date>
    </item>
  </channel>
</rss>

