<?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: Proc Means: &amp;quot;output window&amp;quot; not the same as &amp;quot;output&amp;quot; option in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64744#M18403</link>
    <description>Thanks.  Any idea how i would then get the variable names back to the original names?</description>
    <pubDate>Tue, 17 Aug 2010 06:46:55 GMT</pubDate>
    <dc:creator>CharlesR</dc:creator>
    <dc:date>2010-08-17T06:46:55Z</dc:date>
    <item>
      <title>Proc Means: "output window" not the same as "output" option</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64742#M18401</link>
      <description>Ok, so when i run the following code&lt;BR /&gt;
[pre] proc means data=_9SSummary sum maxdec=0;&lt;BR /&gt;
   var _:;&lt;BR /&gt;
   output out=_9SSummaryA sum=Outs_Hits_Errors n=number;&lt;BR /&gt;
 run;[/pre]&lt;BR /&gt;
&lt;BR /&gt;
the output window gives me what i want: the sum of eacch variable; however, the output data set "_9SSummaryA" then gives the sum of the first variable only.  &lt;BR /&gt;
&lt;BR /&gt;
Help?</description>
      <pubDate>Tue, 17 Aug 2010 05:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64742#M18401</guid>
      <dc:creator>CharlesR</dc:creator>
      <dc:date>2010-08-17T05:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means: "output window" not the same as "output" option</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64743#M18402</link>
      <description>Try using the autoname option on the OUTPUT statement.  It makes life a whole lot easier.&lt;BR /&gt;
[pre]proc means data=sashelp.class sum;&lt;BR /&gt;
var height weight;&lt;BR /&gt;
output out=totals&lt;BR /&gt;
       sum=/autoname;&lt;BR /&gt;
run;[/pre]</description>
      <pubDate>Tue, 17 Aug 2010 05:43:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64743#M18402</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-08-17T05:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means: "output window" not the same as "output" option</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64744#M18403</link>
      <description>Thanks.  Any idea how i would then get the variable names back to the original names?</description>
      <pubDate>Tue, 17 Aug 2010 06:46:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64744#M18403</guid>
      <dc:creator>CharlesR</dc:creator>
      <dc:date>2010-08-17T06:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means: "output window" not the same as "output" option</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64745#M18404</link>
      <description>If by 'original name' you mean the name assigned by you then code the output statement somewhat like&lt;BR /&gt;
[pre]&lt;BR /&gt;
output out=_9SSummaryA &lt;BR /&gt;
  sum(var1)=outvar_name1&lt;BR /&gt;
  sum(var2)=outvar_name2&lt;BR /&gt;
  sum(var3)=outvar_name3&lt;BR /&gt;
  n=number;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 17 Aug 2010 09:03:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64745#M18404</guid>
      <dc:creator>Robert_Bardos</dc:creator>
      <dc:date>2010-08-17T09:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means: "output window" not the same as "output" option</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64746#M18405</link>
      <description>The procedure will name the stats with original names when you use stat= with no variable names following.  However when you want two statistics you will end up needing autoname, and you're right back where you started.&lt;BR /&gt;
&lt;BR /&gt;
I prefer the arrangement of the default data set but you can only get a few statistics and SUM ain't one of them. You might try this.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc means noprint data=sashelp.class;&lt;BR /&gt;
   class sex;&lt;BR /&gt;
   output out=sum sum=;&lt;BR /&gt;
   output out=n   n=;&lt;BR /&gt;
   run;&lt;BR /&gt;
data stats;&lt;BR /&gt;
   set sum(in=in1) n(in=in2);&lt;BR /&gt;
   by _type_ sex;&lt;BR /&gt;
   length _STAT_ $8;&lt;BR /&gt;
   select;&lt;BR /&gt;
      when(in1) _stat_ ='SUM';&lt;BR /&gt;
      when(in2) _stat_ ='N';&lt;BR /&gt;
      end;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print data=stats;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
You have to be careful if you want CLM's.  See &lt;BR /&gt;
&lt;A href="http://tinyurl.com/235pytp" target="_blank"&gt;http://tinyurl.com/235pytp&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://www.sascommunity.org/wiki/Adding_statistics_to_the_PROC_MEANS/SUMMARY_default_output_dataset" target="_blank"&gt;http://www.sascommunity.org/wiki/Adding_statistics_to_the_PROC_MEANS/SUMMARY_default_output_dataset&lt;/A&gt;.&lt;BR /&gt;
&lt;BR /&gt;
for details.  &lt;BR /&gt;
&lt;BR /&gt;
It would be so nice if SAS would just output the default data set with any statistics named in the proc statement.</description>
      <pubDate>Tue, 17 Aug 2010 12:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64746#M18405</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-08-17T12:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means: "output window" not the same as "output" option</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64747#M18406</link>
      <description>Charles&lt;BR /&gt;
&lt;BR /&gt;
your OUTPUT statement requested statistics SUM and N. My output window from PROC MEANS didn't show the N statistic because you put SUM in the proc means statement but not N, so I'm a little confused which is what you wanted.&lt;BR /&gt;
So with nothing else to go on, I'll assume both.&lt;BR /&gt;
I generated this test data[pre]data _9SSummary ;&lt;BR /&gt;
  do _1 = 1 to 3 ;&lt;BR /&gt;
  do _2 = 2 to 4 by 2 ;&lt;BR /&gt;
  do _3 = 3 to 9 by 3 ;&lt;BR /&gt;
     _4= (_1*10 +_2 )*10 +_3  ; &lt;BR /&gt;
     if not mod( _4, 7 ) then   _4=. ; ;&lt;BR /&gt;
     output ;&lt;BR /&gt;
  end; end; end;&lt;BR /&gt;
  stop ;&lt;BR /&gt;
run ;[/pre]***** I wanted to have an analysis variable occasionally missing;&lt;BR /&gt;
&lt;BR /&gt;
When you need only one statistic (say, SUM), PROC MEANS is your best friend&lt;BR /&gt;
proc means  data= _9SSummary nway ;&lt;BR /&gt;
   var _: ;&lt;BR /&gt;
   output sum= out= _9SSummaryA( drop= _type_ _freq_ ) ;&lt;BR /&gt;
rurn ;&lt;BR /&gt;
Then PROC MEANS assumes that the statistics should be named like the original variables from which they are derived. &lt;BR /&gt;
You can even leave out that VAR statement and PROC MEANS will provide the statistics for all numeric variables when that is what you need. &lt;BR /&gt;
There is another &lt;B&gt;excellent feature in PROC MEANS&lt;/B&gt;  ----&amp;gt; more than one OUTPUT statement can be used. &lt;BR /&gt;
So, if you really needed two statistics - create a separate output for each stat.&lt;BR /&gt;
OUTPUT OUT= stat1 SUM= ;&lt;BR /&gt;
OUTPUT OUT= stat2   N= ;&lt;BR /&gt;
Of course you will want to bring the results back together again - how about[pre]proc means data=_9SSummary n sum maxdec= 0;   &lt;BR /&gt;
   var      _: ;   &lt;BR /&gt;
   output   out=_9SSummaryS sum=   ; &lt;BR /&gt;
   output   out=_9SSummaryN   n=   ; &lt;BR /&gt;
run;&lt;BR /&gt;
data together ;&lt;BR /&gt;
   set _9SSummaryN(in= stat2)&lt;BR /&gt;
       _9SSummaryS(in= stat1)  ;&lt;BR /&gt;
   drop _type_ _freq_ ;&lt;BR /&gt;
   if stat1 then _stat_ = 'SUM' ;else _stat_ ='N' ;&lt;BR /&gt;
run ;&lt;BR /&gt;
proc transpose out= _9SSummaryA( rename= _name_= Variable) ;&lt;BR /&gt;
   id _stat_ ;&lt;BR /&gt;
run ;&lt;BR /&gt;
proc print  ;&lt;BR /&gt;
run ;  [/pre]From my brief test data, I got this listing[pre]&lt;BR /&gt;
Obs    Variable     N     SUM&lt;BR /&gt;
&lt;BR /&gt;
 1        _1       18      36&lt;BR /&gt;
 2        _2       18      54&lt;BR /&gt;
 3        _3       18     108&lt;BR /&gt;
 4        _4       15    3450&lt;BR /&gt;
[/pre]&lt;BR /&gt;
So Charles, what was it you wanted?&lt;BR /&gt;
 &lt;BR /&gt;
peterC

looks like I type too slowly ! data _null_; seems to have made my suggestions redundant ;-(&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BR /&gt;
Message was edited by: Peter.C</description>
      <pubDate>Tue, 17 Aug 2010 13:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64747#M18406</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-08-17T13:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means: "output window" not the same as "output" option</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64748#M18407</link>
      <description>&amp;gt; looks like I type too slowly ! data _null_; seems to&lt;BR /&gt;
&amp;gt; have made my suggestions redundant ;-(&lt;BR /&gt;
&lt;BR /&gt;
Perhaps not.  I did not flip to rows to vars with stats as columns.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; proc transpose out= _9SSummaryA( rename= _name_= Variable) ;&lt;BR /&gt;
&lt;BR /&gt;
PROC TRANSPOSE has an option to change the name of _NAME_, NAME=.  Slightly less fiddly than the RENAME data set option.</description>
      <pubDate>Tue, 17 Aug 2010 13:40:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Means-quot-output-window-quot-not-the-same-as-quot-output/m-p/64748#M18407</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-08-17T13:40:19Z</dc:date>
    </item>
  </channel>
</rss>

