<?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: Export Proc Means to Excel in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550724#M152927</link>
    <description>&lt;P&gt;There are many ways but I'll point out two methods:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Create an output data set and export the data set&lt;/P&gt;
&lt;P&gt;2. Have your output directly sent to excel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; PROC MEANS + PROC EXPORT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=Z_score2 stackods;
var X1 X2 X3 X4 X5 Z;
by Costat SIC1_4;
ods output summary = want;
run;

proc export data=want outfile='/folders/myfolders/demo1.xlsx' dbms=xlsx replace;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2. ODS EXCEL&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file='/folders/myfolders/demo2.xlsx' style=seaside;

proc means data=Z_score2;
var X1 X2 X3 X4 X5 Z;
by Costat SIC1_4;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261982"&gt;@Pabster&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all!&lt;BR /&gt;&lt;BR /&gt;It seems to be a very simple quetion but I can't get around it.&lt;BR /&gt;I have obtained data from my data set with Proc means.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=Z_score2;
var X1 X2 X3 X4 X5 Z;
by Costat SIC1_4;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But now I would like to export that proc means data into an excel file automaticaly.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;How can I proceed?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2019 16:53:05 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-04-12T16:53:05Z</dc:date>
    <item>
      <title>Export Proc Means to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550716#M152924</link>
      <description>&lt;P&gt;Hi all!&lt;BR /&gt;&lt;BR /&gt;It seems to be a very simple quetion but I can't get around it.&lt;BR /&gt;I have obtained data from my data set with Proc means.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=Z_score2;
var X1 X2 X3 X4 X5 Z;
by Costat SIC1_4;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But now I would like to export that proc means data into an excel file automaticaly.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;How can I proceed?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 16:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550716#M152924</guid>
      <dc:creator>Pabster</dc:creator>
      <dc:date>2019-04-12T16:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Export Proc Means to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550722#M152926</link>
      <description>&lt;P&gt;If you have the SAS/Interface to PC Files:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ods excel file="&amp;lt;your path&amp;gt;\&amp;lt;yourfilename&amp;gt;.xlsx"
;

proc means data=Z_score2;
var X1 X2 X3 X4 X5 Z;
by Costat SIC1_4;
run;

ods excel close;&lt;/PRE&gt;
&lt;P&gt;is likely simplest.&lt;/P&gt;
&lt;P&gt;If you don't have Interface to PC files the use ODS tagsets.excelxp instead of ods excel.&lt;/P&gt;
&lt;P&gt;You will get complaints from Excel about the file format not matching as tagsets.excelxp creates XML instead of XLSX native formats but hopefully can open it.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 16:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550722#M152926</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-12T16:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Export Proc Means to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550724#M152927</link>
      <description>&lt;P&gt;There are many ways but I'll point out two methods:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Create an output data set and export the data set&lt;/P&gt;
&lt;P&gt;2. Have your output directly sent to excel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; PROC MEANS + PROC EXPORT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=Z_score2 stackods;
var X1 X2 X3 X4 X5 Z;
by Costat SIC1_4;
ods output summary = want;
run;

proc export data=want outfile='/folders/myfolders/demo1.xlsx' dbms=xlsx replace;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2. ODS EXCEL&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file='/folders/myfolders/demo2.xlsx' style=seaside;

proc means data=Z_score2;
var X1 X2 X3 X4 X5 Z;
by Costat SIC1_4;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261982"&gt;@Pabster&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all!&lt;BR /&gt;&lt;BR /&gt;It seems to be a very simple quetion but I can't get around it.&lt;BR /&gt;I have obtained data from my data set with Proc means.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=Z_score2;
var X1 X2 X3 X4 X5 Z;
by Costat SIC1_4;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But now I would like to export that proc means data into an excel file automaticaly.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;How can I proceed?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 16:53:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550724#M152927</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-12T16:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Export Proc Means to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550725#M152928</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=Z_score2;
var X1 X2 X3 X4 X5 Z;
by Costat SIC1_4;
output out=results;
run;

PROC EXPORT DATA= results 
            OUTFILE= "\\path\results.xlsx" 
            DBMS=EXCEL REPLACE;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Apr 2019 16:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550725#M152928</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-04-12T16:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Export Proc Means to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550730#M152929</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;BR /&gt;Thank you very much the 2nd method is perfect!&lt;BR /&gt;&lt;BR /&gt;by any chance do you also know how I could obtain all the data in ONE spreadsheet?&lt;BR /&gt;&lt;BR /&gt;Because this proc means gives me around 100 different sets of data, as you can imagine trying to create graph afterwards might be a bit of a problem with 100tabs&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 17:23:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550730#M152929</guid>
      <dc:creator>Pabster</dc:creator>
      <dc:date>2019-04-12T17:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Export Proc Means to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550732#M152930</link>
      <description>In that case, I'd highly recommend the first option instead, it will give you a single table that's much nicer to use to create your graphs. In fact, you can easily graph that within SAS if needed as well.</description>
      <pubDate>Fri, 12 Apr 2019 17:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550732#M152930</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-12T17:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Export Proc Means to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550733#M152931</link>
      <description>&lt;P&gt;Or you could modify it as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file='/folders/myfolders/demo2.xlsx' style=seaside;

ods select none;
proc means data=Z_score2;
var X1 X2 X3 X4 X5 Z;
by Costat SIC1_4;
ods output summary=want;
run;
ods select all;

proc print data=want;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Apr 2019 17:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550733#M152931</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-12T17:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Export Proc Means to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550736#M152932</link>
      <description>&lt;P&gt;Yeah sadly I haven't reached the graph level in sas but I'll be looking into it soon! Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 17:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550736#M152932</guid>
      <dc:creator>Pabster</dc:creator>
      <dc:date>2019-04-12T17:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Export Proc Means to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550810#M152959</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261982"&gt;@Pabster&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;BR /&gt;Thank you very much the 2nd method is perfect!&lt;BR /&gt;&lt;BR /&gt;by any chance do you also know how I could obtain all the data in ONE spreadsheet?&lt;BR /&gt;&lt;BR /&gt;Because this proc means gives me around 100 different sets of data, as you can imagine trying to create graph afterwards might be a bit of a problem with 100tabs&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If by "100 different sets of data" you mean separate displayed tables for each combination of your variables on the BY statement you can try changing BY to CLASS. That will still provide summaries grouped by the variables but the results are a single table.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;PRE&gt;proc means data=sashelp.class;
   class sex age;
   var height weight;
run;&lt;/PRE&gt;
&lt;P&gt;A secondary benefit is CLASS variables do not need to be sorted as BY variables do.&lt;/P&gt;
&lt;P&gt;Differences in output data sets are available as you can get additional summaries of 1) data overall, 2) each level alone of each class variable, 3) if you have more than 2 class variables you'll also get the combinations of 2, or 3 or what ever smaller number of variables and 4) the combinations of the all levels of all the class variables.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 22:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-Proc-Means-to-Excel/m-p/550810#M152959</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-12T22:56:03Z</dc:date>
    </item>
  </channel>
</rss>

