<?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: ERROR - DATE FORMAT in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821782#M41018</link>
    <description>&lt;P&gt;Formats are assigned with a FORMAT or ATTRIB statement, to use a variable in calculations you always use the variable name only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you cannot use a character format for date values, which are numeric.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jul 2022 06:58:33 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-07-06T06:58:33Z</dc:date>
    <item>
      <title>ERROR - DATE FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821781#M41017</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;        GOPTIONS ACCESSIBLE;
23         DATA NUMERATOR2;
24         SET NUMERATOR;
25         datedif=intck('day',dischargedate$10., eventdate$10.);
                                            ____
                                            388
                                            200
                                            76
ERROR 388-185: Expecting an arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.

ERROR 76-322: Syntax error, statement will be ignored.

26         IF condition = "AAA" AND DATEDIF &amp;lt;= '14' THEN NUM = '1';
27         ELSE IF CONDITION = "HHH" AND DATEDIF &amp;lt;= '7' THEN NUM='1';
28         ELSE IF CONDITION = "CCC" AND DATEDIF &amp;lt;= '14' THEN NUM='1';
29         ELSE IF CONDITION = "DDD" AND DATEDIF &amp;lt;= '14' THEN NUM='1';
30         ELSE IF CONDITION = "EEE" AND DATEDIF &amp;lt;= '30' THEN NUM='1';
31         ELSE IF CONDITION = "PPP" AND DATEDIF &amp;lt;= '30' THEN NUM='1';
32         if datedif = . then DELETE;
33         run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      32:4   
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.NUMERATOR2 may be incomplete.  When this step was stopped there were 0 observations and 34 variables.
WARNING: Data set WORK.NUMERATOR2 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.08 seconds
      cpu time            0.01 seconds
      
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How do I fix this? I'm trying to get a difference between two dates and also format those dates.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 06:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821781#M41017</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-06T06:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR - DATE FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821782#M41018</link>
      <description>&lt;P&gt;Formats are assigned with a FORMAT or ATTRIB statement, to use a variable in calculations you always use the variable name only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you cannot use a character format for date values, which are numeric.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 06:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821782#M41018</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-06T06:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR - DATE FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821855#M41019</link>
      <description>they are characters in my data with length 10</description>
      <pubDate>Wed, 06 Jul 2022 14:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821855#M41019</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-06T14:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR - DATE FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821862#M41020</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;datedif=intck('day',dischargedate, eventdate);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The 2nd and 3rd parameters are dates, so should just have the variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The $10 are typically format references and are not valid in the function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the dates are character and need to be converted to SAS dates that would be done differently.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 14:56:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821862#M41020</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-06T14:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR - DATE FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821863#M41021</link>
      <description>&lt;P&gt;To convert character strings into DATE values use an informat that matches the character pattern.&lt;/P&gt;
&lt;P&gt;So if the 10 characters are in the pattern YYYY-MM-DD then use the yymmdd10. informat. Since dates are stored as number of days to find the difference in day just subtract.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;datedif=input(dischargedate,yymmdd10.) - input(eventdate,yymmdd10.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the pattern is different then use the right informat for that pattern.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 15:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821863#M41021</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-06T15:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR - DATE FORMAT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821910#M41022</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290946"&gt;@bhca60&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;they are characters in my data with length 10&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;WHY?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Such values need to be stored correctly as SAS date values when the data arrives in the SAS environment.&lt;/P&gt;
&lt;P&gt;From which source do you get the data, and how do you import it?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 19:02:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-DATE-FORMAT/m-p/821910#M41022</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-06T19:02:03Z</dc:date>
    </item>
  </channel>
</rss>

