<?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 simple date questions in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/simple-date-questions/m-p/7555#M120</link>
    <description>I have a SAS data set that has information by dates (mmddyy).  I'd like to sum it up by month and year and then use it in a forecast.  I can get it sum by a month and year but the forecast procedure doesn't recognize it as an id variable because it's not a "number/date".  How do you turn dates into monthyear?</description>
    <pubDate>Tue, 18 Mar 2008 18:32:17 GMT</pubDate>
    <dc:creator>jenwright</dc:creator>
    <dc:date>2008-03-18T18:32:17Z</dc:date>
    <item>
      <title>simple date questions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simple-date-questions/m-p/7555#M120</link>
      <description>I have a SAS data set that has information by dates (mmddyy).  I'd like to sum it up by month and year and then use it in a forecast.  I can get it sum by a month and year but the forecast procedure doesn't recognize it as an id variable because it's not a "number/date".  How do you turn dates into monthyear?</description>
      <pubDate>Tue, 18 Mar 2008 18:32:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simple-date-questions/m-p/7555#M120</guid>
      <dc:creator>jenwright</dc:creator>
      <dc:date>2008-03-18T18:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: simple date questions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simple-date-questions/m-p/7556#M121</link>
      <description>Hi:&lt;BR /&gt;
  If your variable is&lt;BR /&gt;
1) numeric&lt;BR /&gt;
2) the number is the number of days since Jan 1, 1960&lt;BR /&gt;
&lt;BR /&gt;
then try a format statement in your procedure:&lt;BR /&gt;
&lt;BR /&gt;
format mydate monyy5.;&lt;BR /&gt;
&lt;BR /&gt;
For example, if I have a date variable called BDAY, a numeric variable that represents birthdate, then this data&lt;BR /&gt;
[pre]&lt;BR /&gt;
Name  Bday&lt;BR /&gt;
alan -3334&lt;BR /&gt;
bob   9099&lt;BR /&gt;
carl -3053&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
could be printed/displayed with:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc freq data=mydata;&lt;BR /&gt;
  tables bday;&lt;BR /&gt;
  format bday mmddyy2.;&lt;BR /&gt;
run;&lt;BR /&gt;
    &lt;BR /&gt;
proc print data=mydata;&lt;BR /&gt;
  format bday monyy5.;&lt;BR /&gt;
run;&lt;BR /&gt;
     &lt;BR /&gt;
proc print data=mydata;&lt;BR /&gt;
  format bday year4.;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
On the other hand, if your variable is a character string that represents a date, then you will need to create a numeric variable from the character variable -- probably in a data step program. Or, you could take an alternate approach and create a separate numeric variable for MONTH and a separate numeric variable YEAR. I hate to say that it depends, but it really does depend....on your forecasting procedure, on whether your date variable is numeric or character. &lt;BR /&gt;
&lt;BR /&gt;
To find out the "type" of your variables -- either character or numeric, run PROC CONTENTS on your data set:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc contents data=mydata;&lt;BR /&gt;
  title 'what are my variables';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Your best bet for help would be to call Tech Support because they can help you with the forecasting procedure question and the how to deal with your date variable question.&lt;BR /&gt;
&lt;BR /&gt;
(Alan was born on 11/15/1950; Bob on 11/29/1984; and Carl on 08/23/1951)&lt;BR /&gt;
&lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
Results from code above (on the BDAY variable)&lt;BR /&gt;
[pre]&lt;BR /&gt;
The FREQ Procedure&lt;BR /&gt;
       &lt;BR /&gt;
                                 Cumulative    Cumulative&lt;BR /&gt;
bday    Frequency     Percent     Frequency      Percent&lt;BR /&gt;
---------------------------------------------------------&lt;BR /&gt;
  11           2       66.67             2        66.67&lt;BR /&gt;
  08           1       33.33             3       100.00&lt;BR /&gt;
   &lt;BR /&gt;
  &lt;BR /&gt;
Obs    name     bday&lt;BR /&gt;
  &lt;BR /&gt;
 1     alan    NOV50&lt;BR /&gt;
 2     bob     NOV84&lt;BR /&gt;
 3     carl    AUG51&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BR /&gt;
Obs    name    bday&lt;BR /&gt;
   &lt;BR /&gt;
 1     alan    1950&lt;BR /&gt;
 2     bob     1984&lt;BR /&gt;
 3     carl    1951&lt;BR /&gt;
&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 18 Mar 2008 21:42:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simple-date-questions/m-p/7556#M121</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-03-18T21:42:00Z</dc:date>
    </item>
  </channel>
</rss>

