<?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: MONYY7 in Summary Statistics not working? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4663#M1494</link>
    <description>Hi:&lt;BR /&gt;
  You are probably using the DATE variable in a CLASS statement (or else you're selecting it as the classification variable) in your task. I can duplicate your issue with code.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data testdate;&lt;BR /&gt;
  set sashelp.prdsale;&lt;BR /&gt;
  ** month IS a SAS date, but formatted to MonName3;&lt;BR /&gt;
  ** so create an explicit date variable and a character date variable;&lt;BR /&gt;
  date = month;&lt;BR /&gt;
  altdate = date;&lt;BR /&gt;
  chardate = put(month,monyy7.);&lt;BR /&gt;
format date monyy7. altdate date9.;&lt;BR /&gt;
run;&lt;BR /&gt;
   &lt;BR /&gt;
proc print data=testdate(obs=15);&lt;BR /&gt;
var prodtype date altdate chardate actual;&lt;BR /&gt;
title 'proc print using formats assigned in data step';&lt;BR /&gt;
run;&lt;BR /&gt;
   &lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc means data=testdate;&lt;BR /&gt;
title 'compare date formats used to proc print of data';&lt;BR /&gt;
var actual;&lt;BR /&gt;
class date altdate;&lt;BR /&gt;
format date monyy7. altdate date9.;&lt;BR /&gt;
run;&lt;BR /&gt;
     &lt;BR /&gt;
proc means data=testdate;&lt;BR /&gt;
title 'using character version of date';&lt;BR /&gt;
var actual;&lt;BR /&gt;
class chardate;&lt;BR /&gt;
run;&lt;BR /&gt;
     &lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
But duplicating the problem doesn't really help you. The workaround that I show in my code is to create a character variable that contains the date formatted with MONYY7 and then use the character variable as the CLASS variable in your summary statistics task. Or just switch over to a code node and submit the proc means code once you create the character version of the date.&lt;BR /&gt;
 &lt;BR /&gt;
However,  I think your best bet for help with this problem is to contact Tech Support. There's something odd happening and Tech Support is the best place to go for help.&lt;BR /&gt;
 &lt;BR /&gt;
To find out how to contact Tech Support, refer to:&lt;BR /&gt;
 &lt;A href="http://support.sas.com/techsup/contact/index.html" target="_blank"&gt;http://support.sas.com/techsup/contact/index.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
    <pubDate>Thu, 13 Sep 2007 04:38:07 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2007-09-13T04:38:07Z</dc:date>
    <item>
      <title>MONYY7 in Summary Statistics not working?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4662#M1493</link>
      <description>I am applying the MONYY7. format to a date field in the Summary Statistics dialog.  However, it always appears in the output as MONYY5.??&lt;BR /&gt;
&lt;BR /&gt;
It works fine in One Way Frequencies, and in other dialogs.&lt;BR /&gt;
&lt;BR /&gt;
The code preview clearly shows the line FORMAT MYDATE MONYY7.&lt;BR /&gt;
&lt;BR /&gt;
Any help is appreciated.</description>
      <pubDate>Wed, 12 Sep 2007 15:34:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4662#M1493</guid>
      <dc:creator>Kenny</dc:creator>
      <dc:date>2007-09-12T15:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: MONYY7 in Summary Statistics not working?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4663#M1494</link>
      <description>Hi:&lt;BR /&gt;
  You are probably using the DATE variable in a CLASS statement (or else you're selecting it as the classification variable) in your task. I can duplicate your issue with code.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data testdate;&lt;BR /&gt;
  set sashelp.prdsale;&lt;BR /&gt;
  ** month IS a SAS date, but formatted to MonName3;&lt;BR /&gt;
  ** so create an explicit date variable and a character date variable;&lt;BR /&gt;
  date = month;&lt;BR /&gt;
  altdate = date;&lt;BR /&gt;
  chardate = put(month,monyy7.);&lt;BR /&gt;
format date monyy7. altdate date9.;&lt;BR /&gt;
run;&lt;BR /&gt;
   &lt;BR /&gt;
proc print data=testdate(obs=15);&lt;BR /&gt;
var prodtype date altdate chardate actual;&lt;BR /&gt;
title 'proc print using formats assigned in data step';&lt;BR /&gt;
run;&lt;BR /&gt;
   &lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc means data=testdate;&lt;BR /&gt;
title 'compare date formats used to proc print of data';&lt;BR /&gt;
var actual;&lt;BR /&gt;
class date altdate;&lt;BR /&gt;
format date monyy7. altdate date9.;&lt;BR /&gt;
run;&lt;BR /&gt;
     &lt;BR /&gt;
proc means data=testdate;&lt;BR /&gt;
title 'using character version of date';&lt;BR /&gt;
var actual;&lt;BR /&gt;
class chardate;&lt;BR /&gt;
run;&lt;BR /&gt;
     &lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
But duplicating the problem doesn't really help you. The workaround that I show in my code is to create a character variable that contains the date formatted with MONYY7 and then use the character variable as the CLASS variable in your summary statistics task. Or just switch over to a code node and submit the proc means code once you create the character version of the date.&lt;BR /&gt;
 &lt;BR /&gt;
However,  I think your best bet for help with this problem is to contact Tech Support. There's something odd happening and Tech Support is the best place to go for help.&lt;BR /&gt;
 &lt;BR /&gt;
To find out how to contact Tech Support, refer to:&lt;BR /&gt;
 &lt;A href="http://support.sas.com/techsup/contact/index.html" target="_blank"&gt;http://support.sas.com/techsup/contact/index.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 13 Sep 2007 04:38:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4663#M1494</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-09-13T04:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: MONYY7 in Summary Statistics not working?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4664#M1495</link>
      <description>Cynthia, if you substitute proc summary with an output statement for your proc means, the class variables "respect" the formats that have been assigned.  Of course, then you would need a proc print to display the results.&lt;BR /&gt;
&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
proc summary data=testdate nway missing;&lt;BR /&gt;
  title 'compare date formats used to proc print of data';&lt;BR /&gt;
  var actual;&lt;BR /&gt;
  class date altdate;&lt;BR /&gt;
  format date monyy7. altdate date9.;&lt;BR /&gt;
  output out=testdate1;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Sep 2007 13:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4664#M1495</guid>
      <dc:creator>advoss</dc:creator>
      <dc:date>2007-09-14T13:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: MONYY7 in Summary Statistics not working?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4665#M1496</link>
      <description>I guess I need to report this as a bug.  I'm assisting end users who are not code savvy, so I want to limit the use of code as much as possible.</description>
      <pubDate>Fri, 14 Sep 2007 14:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4665#M1496</guid>
      <dc:creator>Kenny</dc:creator>
      <dc:date>2007-09-14T14:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: MONYY7 in Summary Statistics not working?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4666#M1497</link>
      <description>Hi:&lt;BR /&gt;
  I see that. It was my understanding that PROC MEANS and PROC SUMMARY were using the SAME code and the only difference was the print/noprint settings.&lt;BR /&gt;
 &lt;BR /&gt;
IF you take the output statement away from the PROC SUMMARY, then you do get the same behavior as when you use PROC MEANS:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc summary data=testdate print;&lt;BR /&gt;
  var actual;&lt;BR /&gt;
  class date altdate;&lt;BR /&gt;
  format date monyy7. altdate date9.;&lt;BR /&gt;
*******output out=testdate1;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
         &lt;BR /&gt;
In fact, if you put the OUTPUT statement in PROC MEANS, then you get the  same results as the PROC SUMMARY with an OUTPUT &lt;BR /&gt;
statement. I think the behavior in either case (ignoring the MONYY format) is incorrect. &lt;BR /&gt;
&lt;BR /&gt;
So I still think that the workaround is:&lt;BR /&gt;
1) convert the date to a character string for the CLASS variable&lt;BR /&gt;
2) always use the OUTPUT statement with either PROC MEANS or  PROC SUMMARY and then always follow it with a PROC PRINT.&lt;BR /&gt;
&lt;BR /&gt;
But there's still the issue of "is this working as designed -- why would you NOT want to respect the format on the CLASS variable, even if the CLASS variable is numeric" -- and that's a question for Tech Support.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 14 Sep 2007 15:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/MONYY7-in-Summary-Statistics-not-working/m-p/4666#M1497</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-09-14T15:43:03Z</dc:date>
    </item>
  </channel>
</rss>

