<?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: Data step - date format and if then else condition (HEDIS measure) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822658#M324849</link>
    <description>yes both conditions are required for each of the 6 conditions (aaa, ccc, hhh...etc.) and they all equal 1 because in the end they will be added up to give a number for the numerator which will then be divided by a denominator number.</description>
    <pubDate>Mon, 11 Jul 2022 20:30:16 GMT</pubDate>
    <dc:creator>bhca60</dc:creator>
    <dc:date>2022-07-11T20:30:16Z</dc:date>
    <item>
      <title>Data step - date format and if then else condition (HEDIS measure)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822654#M324847</link>
      <description>&lt;P&gt;I am trying to get the difference in days between dates (char $10.) and merging two tables that are sorted by id.&amp;nbsp; I'm doing a HEDIS and in the end there has to be a numerator and denominator to get a percentage.&amp;nbsp; This is part of the numerator portion so I'm trying to flag all the conditions that meet what should be in the numerator:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;22         GOPTIONS ACCESSIBLE;
23         DATA NUMERATOR1;
24         MERGE denom_final (in=a)  
25               numerator  (in=b) ;
26         	  DIF_DAYS=intck('day',input(ddate,yymmdd10.), input(edate,yymmdd10.));
27         	  if a;
28         	  if b then condition = "aaa" and DATEDIF &amp;lt;= '14' then Followup='1';
                                                                 ____
                                                                 388
                                                                 202
ERROR 388-185: Expecting an arithmetic operator.

ERROR 202-322: The option or parameter is not recognized and will be ignored.

29         	 ELSE IF CONDITION = "hhh" AND DATEDIF &amp;lt;= '7' THEN Followup='1';
30            	 ELSE IF CONDITION = "ccc" AND DATEDIF &amp;lt;= '14' THEN Followup='1';
31         	 ELSE IF CONDITION = "sss" AND DATEDIF &amp;lt;= '14' THEN Followup='1';
32         	 ELSE IF CONDITION = "ddd" AND DATEDIF &amp;lt;= '30' THEN Followup='1';
33         	 ELSE IF CONDITION = "ooo" AND DATEDIF &amp;lt;= '30' THEN Followup='1';
34              Denom = '1';
35         RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jul 2022 20:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822654#M324847</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-11T20:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Data step - date format and if then else condition (HEDIS measure)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822656#M324848</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if b then condition = "aaa" and DATEDIF &amp;lt;= '14' then Followup='1';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This statement is incorrect, syntax wise.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are you trying to do here? Are both conditions required?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This may possibly be what you need:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if b  &amp;amp; DIF_DAYS &amp;lt;= 14 then do;
    Followup=1;
    condition = 'aaa';
end;&lt;/CODE&gt;&lt;/PRE&gt;
&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;
&lt;P&gt;I am trying to get the difference in days between dates (char $10.) and merging two tables that are sorted by id.&amp;nbsp; I'm doing a HEDIS and in the end there has to be a numerator and denominator to get a percentage.&amp;nbsp; This is part of the numerator portion so I'm trying to flag all the conditions that meet what should be in the numerator:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;22         GOPTIONS ACCESSIBLE;
23         DATA NUMERATOR1;
24         MERGE denom_final (in=a)  
25               numerator  (in=b) ;
26         	  DIF_DAYS=intck('day',input(ddate,yymmdd10.), input(edate,yymmdd10.));
27         	  if a;
28         	  if b then condition = "aaa" and DATEDIF &amp;lt;= '14' then Followup='1';
                                                                 ____
                                                                 388
                                                                 202
ERROR 388-185: Expecting an arithmetic operator.

ERROR 202-322: The option or parameter is not recognized and will be ignored.

29         	 ELSE IF CONDITION = "hhh" AND DATEDIF &amp;lt;= '7' THEN Followup='1';
30            	 ELSE IF CONDITION = "ccc" AND DATEDIF &amp;lt;= '14' THEN Followup='1';
31         	 ELSE IF CONDITION = "sss" AND DATEDIF &amp;lt;= '14' THEN Followup='1';
32         	 ELSE IF CONDITION = "ddd" AND DATEDIF &amp;lt;= '30' THEN Followup='1';
33         	 ELSE IF CONDITION = "ooo" AND DATEDIF &amp;lt;= '30' THEN Followup='1';
34              Denom = '1';
35         RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 20:12:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822656#M324848</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-11T20:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Data step - date format and if then else condition (HEDIS measure)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822658#M324849</link>
      <description>yes both conditions are required for each of the 6 conditions (aaa, ccc, hhh...etc.) and they all equal 1 because in the end they will be added up to give a number for the numerator which will then be divided by a denominator number.</description>
      <pubDate>Mon, 11 Jul 2022 20:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822658#M324849</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-11T20:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Data step - date format and if then else condition (HEDIS measure)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822666#M324850</link>
      <description>&lt;P&gt;Is DIF_DAYS a different variable than DATEDIF?&lt;/P&gt;
&lt;P&gt;You are treating DATEDIF as character (compared to '14' quotes means character).&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 20:43:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822666#M324850</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-11T20:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Data step - date format and if then else condition (HEDIS measure)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822668#M324851</link>
      <description>The Do statement seems to work as it did populate the followup=1 column but I am having issues with the dif_days column and getting a Note about it:&lt;BR /&gt;&lt;BR /&gt;26         	  DIF_DAYS=intck('day', input(ddate,yymmdd10.), input(edate,yymmdd10.));&lt;BR /&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;BR /&gt;      26:32   &lt;BR /&gt;NOTE: Invalid argument to function INPUT at line 26 column 26.</description>
      <pubDate>Mon, 11 Jul 2022 20:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822668#M324851</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-11T20:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Data step - date format and if then else condition (HEDIS measure)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822671#M324852</link>
      <description>I forgot to change those to dif_days but i still get the same error even when changing it to dif_days from datedif.</description>
      <pubDate>Mon, 11 Jul 2022 20:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822671#M324852</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-11T20:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Data step - date format and if then else condition (HEDIS measure)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822672#M324853</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;        DATA NUMERATOR1;
       MERGE denom_final (in=a)  
             numerator  (in=b) ;
        	  DIF_DAYS=intck('day',input(ddate,yymmdd10.), input(edate,yymmdd10.));
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do it in stages.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;post the log from above to make sure it works correctly first.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 20:53:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822672#M324853</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-11T20:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Data step - date format and if then else condition (HEDIS measure)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822673#M324854</link>
      <description>&lt;P&gt;You have a several issues most likely.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Missing dates is a possibility in INTCK&lt;/LI&gt;
&lt;LI&gt;Referring to variables with incorrect names&lt;/LI&gt;
&lt;LI&gt;Referring to variables with incorrect types, ie numeric versus character - '14', '7'&lt;/LI&gt;
&lt;LI&gt;Assigning variables that should be numeric character types, ie followup='1'; Why do you want followup to be a character variable? If you don't plan to do any math on this variable that's fine though.&lt;/LI&gt;
&lt;LI&gt;Incorrect syntax on an IF statement.&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Fix your mistakes one at a time and go through them in ORDER&lt;/STRONG&gt;. Start with the dates and then go down, otherwise, they cause more issues later on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 20:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822673#M324854</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-11T20:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Data step - date format and if then else condition (HEDIS measure)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822677#M324855</link>
      <description>&lt;P&gt;Below is how I came up with ddate as a variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if missing(input(dischdate,yymmdd10.))then ddate= input(edate,yymmdd10.);&lt;BR /&gt;else ddate= input(dischdate,yymmdd10.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So now, I've been trying to get the number of days between ddate and edate since my data is a mix of inpatient and outpatient data and outpatient data does not have dischdate so the edate will replace that if blank.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 21:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822677#M324855</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-11T21:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Data step - date format and if then else condition (HEDIS measure)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822680#M324856</link>
      <description>&lt;P&gt;If that step ran correctly, then ddate is not a character variable as specified in your initial post. In that case you do not need to use the INPUT function in the INTCK function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&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;
&lt;P&gt;Below is how I came up with ddate as a variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if missing(input(dischdate,yymmdd10.))then ddate= input(edate,yymmdd10.);&lt;BR /&gt;else ddate= input(dischdate,yymmdd10.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So now, I've been trying to get the number of days between ddate and edate since my data is a mix of inpatient and outpatient data and outpatient data does not have dischdate so the edate will replace that if blank.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 21:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-step-date-format-and-if-then-else-condition-HEDIS-measure/m-p/822680#M324856</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-11T21:09:06Z</dc:date>
    </item>
  </channel>
</rss>

