<?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: Converting Dates for Proc X11 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337083#M272513</link>
    <description>&lt;P&gt;Mr. Kurt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply, I've replaced all my date values with 1994q1 all the way to 2016q2. How do I format that into a date9. format to get this going?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Saieed&lt;/P&gt;</description>
    <pubDate>Wed, 01 Mar 2017 17:30:24 GMT</pubDate>
    <dc:creator>saieedkhalil</dc:creator>
    <dc:date>2017-03-01T17:30:24Z</dc:date>
    <item>
      <title>Converting Dates for Proc X11</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/336973#M272510</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a very simple data set I am trying to deseasonalize. The data is quarterly. There are two columns in the data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Imported from excel, Column 1 is Period, and Column Two is Total Taxes. Those dates repeat all the way to 2016.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=" dgrid-row dgrid-row-even ui-state-default dgrid-selected ui-state-active"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;03/31/1994&lt;/TD&gt;&lt;TD&gt;7823982&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=" dgrid-row dgrid-row-odd ui-state-default"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;06/30/1994&lt;/TD&gt;&lt;TD&gt;9398529&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=" dgrid-row dgrid-row-even ui-state-default"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;09/30/1994&lt;/TD&gt;&lt;TD&gt;8126101&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV class=" dgrid-row dgrid-row-odd ui-state-default"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;12/31/1994&lt;/TD&gt;&lt;TD&gt;7962473&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this generic Proc X11 code online:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;proc x11 data=dataset;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;monthly date=date;/*needs to be in date9. format*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tables d10 d11 d12 d13;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;output out=output_dataset b1=originald10=seasonald11=adjustedd12=trendd13=irreg;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var variable;/*variable is the variable to be analysed*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But the thing is my dates need to be converted to a date9. format &amp;amp; the code needs to be adjusted for quarterly data, not monthly. I really appreciate any help I can get with this. I am a bit of a noob.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;BR /&gt;Saieed.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 01 Mar 2017 13:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/336973#M272510</guid>
      <dc:creator>saieedkhalil</dc:creator>
      <dc:date>2017-03-01T13:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates for Proc X11</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337005#M272511</link>
      <description>&lt;P&gt;I am not familiar with the x11 proc but its documentation indicates you can use the Quarterly statement if your input data are quarterly. You do not have to use the Monthly statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_x11_sect005.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_x11_sect005.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And looking at the date option on the Quarterly statement, it does not say that the date has to be in a specific format. It only has to contain SAS date values. So as long as your date variable contains SAS dates and it is not a character date variable, you should be fine. See details on Quarterly statement here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_x11_sect015.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_x11_sect015.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 14:48:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337005#M272511</guid>
      <dc:creator>nehalsanghvi</dc:creator>
      <dc:date>2017-03-01T14:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates for Proc X11</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337006#M272512</link>
      <description>&lt;P&gt;If your column 1 is of type character, you need to create a SAS date variable from it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;datevar = input(column1,mmddyy10.);
format datevar date9.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then use datevar in place of column1.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 14:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337006#M272512</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-01T14:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates for Proc X11</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337083#M272513</link>
      <description>&lt;P&gt;Mr. Kurt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply, I've replaced all my date values with 1994q1 all the way to 2016q2. How do I format that into a date9. format to get this going?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Saieed&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 17:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337083#M272513</guid>
      <dc:creator>saieedkhalil</dc:creator>
      <dc:date>2017-03-01T17:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates for Proc X11</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337084#M272514</link>
      <description>&lt;P&gt;I tried this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATANYTaxes;&lt;BR /&gt;SET NYTaxes;&lt;BR /&gt;datevar = input(date,yyyyQq.);&lt;BR /&gt;format datevar date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and got this response:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;68 datevar = input(date,yyyyQq.);&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_______&lt;/DIV&gt;&lt;DIV class="sasError"&gt;485&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE 485-185: Informat YYYYQQ was not found or could not be loaded.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;PS My columns are date and TotalNYSTaxes respectively, with dates from 1994q1 to 2016q2/&lt;/DIV&gt;</description>
      <pubDate>Wed, 01 Mar 2017 17:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337084#M272514</guid>
      <dc:creator>saieedkhalil</dc:creator>
      <dc:date>2017-03-01T17:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Dates for Proc X11</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337261#M272515</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105328"&gt;@saieedkhalil&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I tried this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATANYTaxes;&lt;BR /&gt;SET NYTaxes;&lt;BR /&gt;datevar = input(date,yyyyQq.);&lt;BR /&gt;format datevar date9.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and got this response:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasSource"&gt;68 datevar = input(date,yyyyQq.);&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_______&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;485&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;NOTE 485-185: Informat YYYYQQ was not found or could not be loaded.&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;PS My columns are date and TotalNYSTaxes respectively, with dates from 1994q1 to 2016q2/&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since a SAS data value is a number of days from a given starting date (01jan1960), SAS only has informats that contain also day values. formats that do not display a complete data value have no equivalent informat.&lt;/P&gt;
&lt;P&gt;So you need to convert your YYYYqQ string into something that contains a complete date, and then you can use a date informat:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length date_int $10;
format datevar yymmddd10.;
date_int = substr(date,1,4) !! '-' !! put(input(substr(date,6,1),1.)*3,z2.) !! '-01';
datevar = input(date_int,yymmdd10.);
datevar = intnx('month',datevar,0,'end');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The final statement sets the date to the last day of the quarter, as I guess this would be more useful.&lt;/P&gt;
&lt;P&gt;You can then use the YYQ6. format to display the date as a quarter.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 08:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Dates-for-Proc-X11/m-p/337261#M272515</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-02T08:35:53Z</dc:date>
    </item>
  </channel>
</rss>

