<?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: Hardcode date for one subject in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482027#M124791</link>
    <description>&lt;P&gt;Date is a numeric type with format&amp;nbsp;E8601DA10. in the original data set.&lt;/P&gt;&lt;P&gt;Yes you are right: This is how the date is seen in the original data set&lt;/P&gt;&lt;P&gt;For example 2018-02-27 but needs to be hardcoded as 26FEB2018.&lt;/P&gt;&lt;P&gt;Just adding d isn't working because of the above condition?&lt;/P&gt;&lt;P&gt;How to handle this?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nasya&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jul 2018 17:27:01 GMT</pubDate>
    <dc:creator>Nasya</dc:creator>
    <dc:date>2018-07-30T17:27:01Z</dc:date>
    <item>
      <title>Hardcode date for one subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482002#M124783</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to hardcode the existing date value which is numeric for one of the ID's which are character in nature. There are multiple records for a single ID.&lt;/P&gt;&lt;P&gt;Here is the example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Date&lt;/P&gt;&lt;P&gt;001-01&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;26-Feb-2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;27-Feb-2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;001-01&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 26-Feb-2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;27-Feb-2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;002-02&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;27-March-2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;27-March-2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;002-02&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;27-March-2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;27-March-2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;002-02&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;27-March-2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;27-March-2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;002-02&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;27-March-2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;27-March-2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;003-03&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01-Jan-2017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;01-Jan-2017&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;003-03&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01-Jan-2017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;01-Jan-2017&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;003-03&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01-Jan-2017&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01-Jan-2017&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;004-04&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 08-Nov-2016&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;08-Nov-2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;004-04&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 08-Nov-2016&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;08-Nov-2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;005-05&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 06-March-2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;06-March-2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;005-05&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 06-March-2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;06-March-2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;005-05&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 06-March-2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;06-March-2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;005-05&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 06-March-2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;06-March-2018&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data raw ;
       set dm;
        by ID;
   
    if ID= "001-01" and Date= "26FEB2018" then do;
       Date="27FEB2018";
       end;
  
run;
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I see this following error with the above code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any suggestions please.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Nasya&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482002#M124783</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-07-27T19:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Hardcode date for one subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482004#M124784</link>
      <description>&lt;P&gt;You simply need to add d after the closing quote of your date string to make SAS understand it needs to treat it as a date and not a string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482004#M124784</guid>
      <dc:creator>ybolduc</dc:creator>
      <dc:date>2018-07-27T19:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Hardcode date for one subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482006#M124785</link>
      <description>&lt;P&gt;Is your "date" variable character or numeric with a format attached?&lt;/P&gt;
&lt;P&gt;It is best to show messages from the log by copying the data step or procedure code along with the messages from log (One copy) and paste into a code box opened on the forum with the {I} menu icon.&lt;/P&gt;
&lt;P&gt;That way see everything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the date variable is actually numeric you need to use the form "27FEB2018"&lt;STRONG&gt;d&lt;/STRONG&gt;&amp;nbsp;or "28FEB2018'd to tell SAS that the value is a date literal and not a character value.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482006#M124785</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-07-27T19:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Hardcode date for one subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482007#M124786</link>
      <description>&lt;P&gt;Are the date variables character? If so, thats not a good idea and you should convert them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If they are characters your match string has to be exactly the same, which in this case it's clearly not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data is shown as 28-Feb-2018, but your comparison string is in the date9 format, 28Feb2018. If it's even a different case or an extra space it won't match.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's a number, just add the d after the quotation marks to tell SAS that it's a date.&amp;nbsp;&lt;BR /&gt;In fact, since it says character to numeric conversion, I suspect it's actually a date, so adding the d is all you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;d -&amp;gt; date literal&lt;/P&gt;
&lt;P&gt;n -&amp;gt; name literal&lt;/P&gt;
&lt;P&gt;t -&amp;gt; time literal&lt;/P&gt;
&lt;P&gt;dt -&amp;gt; datetime literal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  if ID= "001-01" and Date= "26FEB2018"d then Date="27FEB2018"d;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482007#M124786</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-27T19:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Hardcode date for one subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482027#M124791</link>
      <description>&lt;P&gt;Date is a numeric type with format&amp;nbsp;E8601DA10. in the original data set.&lt;/P&gt;&lt;P&gt;Yes you are right: This is how the date is seen in the original data set&lt;/P&gt;&lt;P&gt;For example 2018-02-27 but needs to be hardcoded as 26FEB2018.&lt;/P&gt;&lt;P&gt;Just adding d isn't working because of the above condition?&lt;/P&gt;&lt;P&gt;How to handle this?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nasya&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 17:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482027#M124791</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-07-30T17:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Hardcode date for one subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482030#M124793</link>
      <description>&lt;P&gt;Yes, date is numeric with a format&amp;nbsp;E8601DA10.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 20:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482030#M124793</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-07-27T20:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Hardcode date for one subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482057#M124802</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/211652"&gt;@Nasya&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Date is a numeric type with format&amp;nbsp;E8601DA10. in the original data set.&lt;/P&gt;
&lt;P&gt;Yes you are right: This is how the date is seen in the original data set&lt;/P&gt;
&lt;P&gt;For example 2018-02-27 but needs to be hardcoded as 26FEB2018.&lt;/P&gt;
&lt;P&gt;Just adding d isn't working because of the above condition?&lt;/P&gt;
&lt;P&gt;How to handle this?&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Ep**bleep**ha&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Post your modified code and log. Including D alone should fix the issue, since SAS requires dates to be specified in the date9 format with the d. What makes you think it's not working?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 21:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482057#M124802</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-27T21:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Hardcode date for one subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482126#M124821</link>
      <description>&lt;P&gt;Hi Nasya,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The format you apply on your columns does not matter here. When using date constants, SAS expects them to be in a given format. As I mentionned earlier, if you add a d at the end like '26FEB2018'd, you should obtain the behaviour you are looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For more details, please refer to the SAS Documentation: &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780334.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780334.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jul 2018 01:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hardcode-date-for-one-subject/m-p/482126#M124821</guid>
      <dc:creator>ybolduc</dc:creator>
      <dc:date>2018-07-28T01:11:38Z</dc:date>
    </item>
  </channel>
</rss>

