<?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: how to filter character variable month to create a new dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616958#M180720</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;Hi sir, could you explain what does "01" represent inside of CATS function?&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jan 2020 16:27:07 GMT</pubDate>
    <dc:creator>ForrestYao</dc:creator>
    <dc:date>2020-01-13T16:27:07Z</dc:date>
    <item>
      <title>how to filter character variable month to create a new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616945#M180716</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with multiple variables for fiscal year 2019. One column called Year is a numeric variable eg 2018, 2019 etc. Another column called month is a character variable eg Oct, Nov, Dec etc. I need to generate a new dataset called fiscal year 2020 which contains everything from 2018 November to 2019 October. My patial code is:&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table perm._fydata_2020 as&lt;BR /&gt;select * from perm._fydata_2019&lt;BR /&gt;where month...(should start from 2018 Nov to 2019 Oct)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because month is a character variable, I am wondering how do I filter a character variable...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 16:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616945#M180716</guid>
      <dc:creator>ForrestYao</dc:creator>
      <dc:date>2020-01-13T16:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter character variable month to create a new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616950#M180718</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264359"&gt;@ForrestYao&lt;/a&gt;&amp;nbsp; Something like the below where expression may work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where '01nov2018'd&amp;lt;=input(cats('01',month,year),date9.)&amp;lt;='31oct2019'd&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jan 2020 16:13:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616950#M180718</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-01-13T16:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter character variable month to create a new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616952#M180719</link>
      <description>&lt;P&gt;One way is listing them out individually...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE Month in ('string1', 'string2', 'string3')
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What you might be able to try to do is setup a sort that has it sorted in the correct order and then rank them. At that point you could filter based off the rank possibly. If you have an example dataset it would be easier to help expand on potential solutions.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 16:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616952#M180719</guid>
      <dc:creator>Krueger</dc:creator>
      <dc:date>2020-01-13T16:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter character variable month to create a new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616958#M180720</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;Hi sir, could you explain what does "01" represent inside of CATS function?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 16:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616958#M180720</guid>
      <dc:creator>ForrestYao</dc:creator>
      <dc:date>2020-01-13T16:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to filter character variable month to create a new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616961#M180721</link>
      <description>&lt;P&gt;First off, to &lt;STRIKE&gt;Sir&lt;/STRIKE&gt; who is that? I am a SAS Janitor.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Okay, basically, I am concatenating a constant &lt;STRONG&gt;&lt;EM&gt;day&lt;/EM&gt; &lt;/STRONG&gt;value with '01' as the 1st day of the month. Since your range that you mentioned 2018 NOV-OCT2019. It's safe to assume the whole months starting from 01NOV2019 to 31OCT2019. Assuming you do not have a DATE or DAY variable with values of day of the month, the best bet is to have the 1st day of the month making it inclusive in the specified range.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, you do have the other 2. Therefore the concatenated string would look like 01NOV2018 etc. Then you convert the string to a numeric value using the INFORMAT date9. . I suppose everything else is straight forward plugging in the range within the WHERE clause. Hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&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/264359"&gt;@ForrestYao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;STRIKE&gt;Hi sir,&lt;/STRIKE&gt; could you explain what does "01" represent inside of CATS function?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 16:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-filter-character-variable-month-to-create-a-new-dataset/m-p/616961#M180721</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-01-13T16:33:20Z</dc:date>
    </item>
  </channel>
</rss>

