<?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: Help in Dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677117#M204226</link>
    <description>Those variable names do not match the code shown.&lt;BR /&gt;Variables shown are called TRXN_EX_DATE, join code is shown using TRANS_DATE. &lt;BR /&gt;&lt;BR /&gt;Show your actual code and log for starters.</description>
    <pubDate>Sun, 16 Aug 2020 22:03:58 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-08-16T22:03:58Z</dc:date>
    <item>
      <title>Help in Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677084#M204205</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use this specific filter for my program&amp;nbsp;in Proc Sql , while joining tables, &amp;nbsp;but I am not getting any desired output.&lt;/P&gt;&lt;P&gt;Select&amp;nbsp; a.*&lt;/P&gt;&lt;P&gt;from test a&lt;/P&gt;&lt;P&gt;left join test1 b on a.id=b.id and&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;a.Trans_DT-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;lt;= B.Trans_DT &amp;lt;= A.Trans_DT&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried coverting&amp;nbsp;&amp;nbsp;Trans_dt&amp;nbsp; to various formats, but getting like numbers 21998 etc&lt;/P&gt;&lt;P&gt;datepart(Tran_DT) &amp;nbsp;format = date9. (mmddyy10., best16.) &amp;nbsp;as Trans_dt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for checking !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 16:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677084#M204205</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2020-08-16T16:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677085#M204206</link>
      <description>&lt;P&gt;If this code runs without ERRORs, please run PROC CONTENTS on both datasets and show us the respective lines for the&amp;nbsp;&lt;SPAN&gt;Trans_DT variables. Also show us how the dates display in a viewtable window of these datasets.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 16:28:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677085#M204206</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-16T16:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677089#M204210</link>
      <description>Alphabetic List of Variables and Attributes (dataset 1)&lt;BR /&gt;# Variable Type Len Format&lt;BR /&gt;1 TRXN_EX_date Num 8 DATE9.&lt;BR /&gt;&lt;BR /&gt;(Trxn_ex_date-2) as calculated_tran&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Alphabetic List of Variables and Attributes dataset 2&lt;BR /&gt;# Variable Type Len Format&lt;BR /&gt;1 TRXN_EX_date Num 8 DATE9.&lt;BR /&gt;2 calculated_tran Num 8&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 16 Aug 2020 16:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677089#M204210</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2020-08-16T16:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677090#M204211</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/86703"&gt;@Kalai2008&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Alphabetic List of Variables and Attributes (dataset 1)&lt;BR /&gt;# Variable Type Len Format&lt;BR /&gt;1 TRXN_EX_date Num 8 DATE9.&lt;BR /&gt;&lt;BR /&gt;(Trxn_ex_date-2) as calculated_tran&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Alphabetic List of Variables and Attributes dataset 2&lt;BR /&gt;# Variable Type Len Format&lt;BR /&gt;1 TRXN_EX_date Num 8 DATE9.&lt;BR /&gt;2 calculated_tran Num 8&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This really doesn't help, since your original code used a variable named TRANS_DT, we need to see the PROC CONTENTS on that variable in data set TEST, and PROC CONTENTS on that variable in data set TEST1; and showing us PROC CONTENTS on these other variables from other data sets helps not a bit. In fact, it would really help if you showed us a portion of the data sets test and test1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Select  a.* from test a
left join test1 b on a.id=b.id and
a.Trans_DT-2 &amp;lt;= B.Trans_DT &amp;lt;= A.Trans_DT&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;doesn't depend on formats anyway. SAS always uses the unformatted values (like 21998) to compare numbers/dates/datetimes, no matter how they are formatted. So, if it does not work, &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;you have to tell us what didn't work&lt;/STRONG&gt;&lt;/FONT&gt; ... did you get the wrong output (if so, please show us and explain what is wrong)? Or did you get errors in the log (if so, please show us the entire LOG for PROC SQL)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We need a lot more information.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 17:31:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677090#M204211</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-16T17:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677091#M204212</link>
      <description>&lt;P&gt;In your code as posted you only used&amp;nbsp;&lt;SPAN&gt;Trans_DT from both datasets. Please be consistent, and post the code&amp;nbsp;&lt;EM&gt;as you run it&lt;/EM&gt;, and the attributes of the variables&amp;nbsp;&lt;EM&gt;as you use them&lt;/EM&gt;!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 17:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677091#M204212</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-16T17:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677094#M204215</link>
      <description>Thank you for checking, My dataset is huge with million records and due to data privacy issues, I cant share any. But I just showed you some sample from that date. The Tran_ex_date is same as trans_dt and I changed it to date9. format.</description>
      <pubDate>Sun, 16 Aug 2020 17:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677094#M204215</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2020-08-16T17:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677099#M204220</link>
      <description>&lt;P&gt;You should be able to share the MIN and MAX value of some arbitrary date variable. Similarly for lines from your SAS LOG.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember that changing the instructions for how a variable is displayed does not in any way change the value that is stored in the variable.&amp;nbsp; So whether you use DATE, MMDDYY, DDMMYY, YYMMDD or any other date type format to display the values does not matter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variable has DATETIME values (number of seconds) then you would need to convert it to a DATE value (number of days) before comparing it to a date value.&amp;nbsp; &amp;nbsp;If it is a string that a human would thinks looks like a date value then you will need to convert it to a date value using INPUT() function with an appropriate informat for the string.&amp;nbsp;If it is a number that a human might think looks like a date (such as YY,YYM,MDD&amp;nbsp; or MM,DDY,YYYY) then you will need to first convert it to an actual date value by converting the number to a string using PUT() function with Z8. format and then then INPUT() function with the appropriate informat.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 18:43:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677099#M204220</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-16T18:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677100#M204221</link>
      <description>&lt;P&gt;I am just asking for the bleeping &lt;EM&gt;metadata&lt;/EM&gt;, no real values! And if you're so paranoid that you don't want to even show the variable&amp;nbsp;&lt;EM&gt;names&lt;/EM&gt;, then change them &lt;EM&gt;consistently&lt;/EM&gt; in the code and the metadata you show us. Without having a clue, how should we help you?&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 18:49:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677100#M204221</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-16T18:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677101#M204222</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/86703"&gt;@Kalai2008&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you for checking, My dataset is huge with million records and due to data privacy issues, I cant share any. But I just showed you some sample from that date. The Tran_ex_date is same as trans_dt and I changed it to date9. format.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As stated above, we need to see the code you are running, not some made up code. If you can't show us the data, then you can make up some similar data and run that and show us the made up data. It doesn't have to be millions of records; you can make up 20 records of data, or even use real data with made up IDs. I also specifically asked you to tell us what is wrong when you run your code, instead of simply saying "I am not getting any desired output" and providing no other details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Until we get more information from you, we probably can't help.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 18:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677101#M204222</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-16T18:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677117#M204226</link>
      <description>Those variable names do not match the code shown.&lt;BR /&gt;Variables shown are called TRXN_EX_DATE, join code is shown using TRANS_DATE. &lt;BR /&gt;&lt;BR /&gt;Show your actual code and log for starters.</description>
      <pubDate>Sun, 16 Aug 2020 22:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-Dates/m-p/677117#M204226</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-16T22:03:58Z</dc:date>
    </item>
  </channel>
</rss>

