<?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 as numeric in data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/807082#M318114</link>
    <description>&lt;P&gt;Hello saskiwi,&lt;/P&gt;
&lt;P&gt;This is not doable. That has legal consequences.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blue &amp;amp; blue&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2022 02:33:22 GMT</pubDate>
    <dc:creator>GN0001</dc:creator>
    <dc:date>2022-04-11T02:33:22Z</dc:date>
    <item>
      <title>date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804192#M316652</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have a date variable of numeric data type. I put this variable in a year function to get the year portion of the date.&lt;/P&gt;
&lt;P&gt;The result is 2022 as a character. Then I use this 2022 in a single quote in a where clause in a proc sql that groups the data, as soon as I put a.year = '2022', it returns 0 rows back.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table mytable as
select a,*, b.id, b.event,  b.year, b.codetype, count(a.event) 
from thattable a inner join thistable b on a.id=b.id
where a.year ='2020' and b.codeType = 'hhhh'
group by a.id, b.id, b.codetype,b.year;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blue &amp;amp; blue&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 22:13:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804192#M316652</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-03-25T22:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804195#M316655</link>
      <description>The output of the YEAR function is numeric, not character.  Remove the quotes.</description>
      <pubDate>Fri, 25 Mar 2022 22:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804195#M316655</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-03-25T22:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804197#M316656</link>
      <description>&lt;P&gt;You can easily fix this type of problem for yourself by reviewing your SAS log. Most likely there will be notes, warnings or errors giving clues as to what has happened.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you do this?! If not it is time to learn about using your SAS log to your advantage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also you can easily check the variable definitions in MYTABLE by using PROC CONTENTS. That will likely confirm that YEAR is numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 23:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804197#M316656</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-03-25T23:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804210#M316668</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;
&lt;P&gt;the date is numeric in the dataset from which I read my data. It is displayed as 2022-01-12 in the dataset.&lt;/P&gt;
&lt;P&gt;logs says: Error: where clause operator requires compatible variable.&lt;/P&gt;
&lt;P&gt;note: Numeric values have been converted to character values at th places bive by: (line): (column).&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;b&amp;amp;b&lt;/P&gt;</description>
      <pubDate>Sat, 26 Mar 2022 02:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804210#M316668</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-03-26T02:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804221#M316674</link>
      <description>&lt;P&gt;If you assign a numeric value into a character variable SAS will convert the number into a string that is RIGHT ALIGNED in the character variable.&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where left(a.year) ='2020'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That will remove the leading spaces from the character variable.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Mar 2022 04:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804221#M316674</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-26T04:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804222#M316675</link>
      <description>&lt;P&gt;Did you try removing the quotes as suggested by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt; ? That is the most likely cause of that error.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Mar 2022 05:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804222#M316675</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-03-26T05:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804223#M316676</link>
      <description>&lt;P&gt;Show the complete log of the step where you create year using the YEAR function.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Mar 2022 05:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804223#M316676</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-26T05:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804631#M316879</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I resolved this (that is what I think)&lt;/P&gt;
&lt;P&gt;When I coded as this:&lt;/P&gt;
&lt;P&gt;data mydate (Keep= id, dateofservice, year, month)&lt;/P&gt;
&lt;P&gt;The year is defined as string not numeric.&lt;/P&gt;
&lt;P&gt;so then year = Year(dateofservice) is converted to a character, which is not correct.&lt;/P&gt;
&lt;P&gt;What I did, I convert year into numeric in data steps before year function, so the result of year function in the year variable would be a numeric not a character data type.&lt;/P&gt;
&lt;P&gt;So, when I filter data in where clause, my data is filtered correct.&lt;/P&gt;
&lt;P&gt;Respectfully,&lt;/P&gt;
&lt;P&gt;b&amp;amp;b&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 21:40:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804631#M316879</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-03-28T21:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804632#M316880</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I can present some parts of the log; I can't display all the log. It belongs to my company where the information should be kept confident.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;b&amp;amp;b&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 21:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804632#M316880</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-03-28T21:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804638#M316884</link>
      <description>&lt;P&gt;Disguise sensitive names using paint tools before posting. SAS errors, warnings and notes aren't confidential and we need to see them to be able to help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively make up an example to demonstrate your problem and post that.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 22:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804638#M316884</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-03-28T22:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804698#M316921</link>
      <description>&lt;P&gt;Post the complete log as text, and overwrite sensitive names with something easily recognized, e.g. &amp;lt;redacted&amp;gt;, or a string of capital X's.&lt;/P&gt;
&lt;P&gt;The log (and always, the&amp;nbsp;&lt;EM&gt;complete&lt;/EM&gt; log) is our #1diagnostic tool (see Maxim 2).&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 09:26:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804698#M316921</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-29T09:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804909#M317005</link>
      <description>Hello SASKiwi,&lt;BR /&gt;I can't email anything out from my work email. If I want to reconstruct them that might take a long time. I hope this makes sense for everyone. The log is in my work computer. &lt;BR /&gt;Thanks,&lt;BR /&gt;b&amp;amp;b</description>
      <pubDate>Tue, 29 Mar 2022 22:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804909#M317005</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-03-29T22:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804910#M317006</link>
      <description>&lt;P&gt;Hello teamate,&lt;/P&gt;
&lt;P&gt;I can't email the log from my work email, unfortunately.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;b&amp;amp;b&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 22:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804910#M317006</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-03-29T22:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804928#M317019</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp; - Do you not have internet access on your work computer? If you do have internet access you can just copy from your SAS log and paste into SAS Communities post.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 01:14:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804928#M317019</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-03-30T01:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804997#M317069</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello teamate,&lt;/P&gt;
&lt;P&gt;I can't email the log from my work email, unfortunately.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;b&amp;amp;b&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No need for mails. Just copy/paste.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 09:51:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/804997#M317069</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-30T09:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: date as numeric in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/807082#M318114</link>
      <description>&lt;P&gt;Hello saskiwi,&lt;/P&gt;
&lt;P&gt;This is not doable. That has legal consequences.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blue &amp;amp; blue&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 02:33:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-as-numeric-in-data-step/m-p/807082#M318114</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-04-11T02:33:22Z</dc:date>
    </item>
  </channel>
</rss>

