<?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: Exporting a sas data set into .xls in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320302#M70521</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;You can do the following with the IML interface to R

HAVE ( Two SAS Datasets  sashelp.class males and females )

Up to 40 obs from sd1.males total obs=10

Obs    NAME       SEX    AGE

  1    Alfred      M      14
  2    Henry       M      14
  3    James       M      12
  4    Jeffrey     M      13
  5    John        M      12
  6    Philip      M      16
  7    Robert      M      12
  8    Ronald      M      15
  9    Thomas      M      11
 10    William     M      15


Up to 40 obs from sd1.females total obs=9

Obs    NAME       SEX    AGE

 1     Alice       F      13
 2     Barbara     F      13
 3     Carol       F      14
 4     Jane        F      12
 5     Janet       F      15
 6     Joyce       F      11
 7     Judy        F      14
 8     Louise      F      12
 9     Mary        F      15

WANT Excel sheet mf with side by side reports

     ------+-----------+------+---------+--------+-----------+------+------+
EXCEL   A  |     B     |   C  |    D    |   E    |   F       |  G   |  H   |
ROW  +-----+-----------+------+---------+--------+-----------+------+------+
  1  |                                                                     |
  2  |         NAME       SEX    AGE                NAME       SEX    AGE  |
  3  |         Alfred      M      14                Alice       F      13  |
  4  |         Henry       M      14                Barbara     F      13  |
  5  |         James       M      12                Carol       F      14  |
  6  |         Jeffrey     M      13                Jane        F      12  |
  7  |         John        M      12                Janet       F      15  |
  8  |         Philip      M      16                Joyce       F      11  |
  9  |         Robert      M      12                Judy        F      14  |
 10  |         Ronald      M      15                Louise      F      12  |
 11  |         Thomas      M      11                Mary        F      15  |
 12  |         William     M      15                                       |
     +-----+-----------+------+---------+--------+-----------+------+------+

 ____        _       _   _
/ ___|  ___ | |_   _| |_(_) ___  _ __
\___ \ / _ \| | | | | __| |/ _ \| '_ \
 ___) | (_) | | |_| | |_| | (_) | | | |
|____/ \___/|_|\__,_|\__|_|\___/|_| |_|

%utl_submit_r64('
library(XLConnect);
wb &amp;lt;- loadWorkbook("d:/xls/class1.xlsx");
createSheet ( wb , "sheet3" );
prcntg &amp;lt;- createCellStyle(wb);
setDataFormat(prcntg, format = "$00,000.00");
sheet1 = readWorksheet(wb, sheet = getSheets(wb)[1]);
sheet2 = readWorksheet(wb, sheet = getSheets(wb)[2]);
writeWorksheet(wb,sheet1,sheet="sheet3",startCol=1,header=T);
writeWorksheet(wb,sheet2,sheet="sheet3",startCol=6,header=T);
setCellStyle(wb, sheet = "sheet3", row = 1:17, col = 3, cellstyle = prcntg);
setCellStyle(wb, sheet = "sheet3", row = 1:17, col = 7, cellstyle = prcntg);
saveWorkbook(wb,"d:/xls/class1.xlsx");
');
 _     ___   ____
| |   / _ \ / ___|
| |  | | | | |  _
| |__| |_| | |_| |
|_____\___/ \____|

&amp;gt; library(haven);library(XLConnect);males&amp;lt;-read_sas("d:/sd1/males.sas7bdat");
females&amp;lt;-read_sas("d:/sd1/females.sas7bdat");
wb &amp;lt;- loadWorkbook("d:/xls/class_mf.xlsx", create
 = TRUE);createSheet(wb, name = "mf");
writeWorksheet(wb, males, sheet = "mf", startRow = 2, startCol = 2,header=T);
writeWorksheet(wb, females, sheet = "mf", startRow = 2,
startCol = 6,header=T);saveWorkbook(wb);
&amp;gt;
NOTE: 4 lines were written to file PRINT.
Stderr output:
Loading required package: XLConnectJars
XLConnect 0.2-12 by Mirai Solutions GmbH [aut],
  Martin Studer [cre],
  The Apache Software Foundation [ctb, cph] (Apache POI, Apache Commons
    Codec),
  Stephen Colebourne [ctb, cph] (Joda-Time Java library),
  Graph Builder [ctb, cph] (Curvesapi Java library)
http://www.mirai-solutions.com ,
http://miraisolutions.wordpress.com

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Dec 2016 16:52:43 GMT</pubDate>
    <dc:creator>rogerjdeangelis</dc:creator>
    <dc:date>2016-12-20T16:52:43Z</dc:date>
    <item>
      <title>Exporting a sas data set into .xls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320004#M70391</link>
      <description>&lt;P&gt;I have in SAS several tables which I’d like to present in Excel from the first row. But I’d like to fix upper left corner. Example below: A1, O1, AC1. Cal I show it in SAS code?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 19:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320004#M70391</guid>
      <dc:creator>Vladimir</dc:creator>
      <dc:date>2016-12-19T19:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a sas data set into .xls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320009#M70395</link>
      <description>&lt;P&gt;Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't mention what you used to create your output and I'm not opening the xls to try to guess. Anything that involves formatting or appearance options will require an ODS destination.&amp;nbsp;Either ODS Excel or ODS tagsets.excelxp. Report procedures such as Proc Print, Tabulate and Report allow providing options to control output appearance.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 19:31:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320009#M70395</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-19T19:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a sas data set into .xls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320030#M70401</link>
      <description>&lt;P&gt;AFAIK you can't get a native Excel file this way, but a different tagset can be used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the PANELING option of the the MSOFFICE2K_x Tagsets:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A title="http://support.sas.com/rnd/base/ods/odsmarkup/msoffice2k/index.html" href="http://support.sas.com/rnd/base/ods/odsmarkup/msoffice2k/index.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Base SAS: The MSOffice2K_x Tagset Adds Options to the MSOffice2K Tagset&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 20:37:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320030#M70401</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-19T20:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a sas data set into .xls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320301#M70520</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;You can do the following with the IML interface to R

HAVE ( Two SAS Datasets  sashelp.class males and females )

Up to 40 obs from sd1.males total obs=10

Obs    NAME       SEX    AGE

  1    Alfred      M      14
  2    Henry       M      14
  3    James       M      12
  4    Jeffrey     M      13
  5    John        M      12
  6    Philip      M      16
  7    Robert      M      12
  8    Ronald      M      15
  9    Thomas      M      11
 10    William     M      15


Up to 40 obs from sd1.females total obs=9

Obs    NAME       SEX    AGE

 1     Alice       F      13
 2     Barbara     F      13
 3     Carol       F      14
 4     Jane        F      12
 5     Janet       F      15
 6     Joyce       F      11
 7     Judy        F      14
 8     Louise      F      12
 9     Mary        F      15

WANT Excel sheet mf with side by side reports

     ------+-----------+------+---------+--------+-----------+------+------+
EXCEL   A  |     B     |   C  |    D    |   E    |   F       |  G   |  H   |
ROW  +-----+-----------+------+---------+--------+-----------+------+------+
  1  |                                                                     |
  2  |         NAME       SEX    AGE                NAME       SEX    AGE  |
  3  |         Alfred      M      14                Alice       F      13  |
  4  |         Henry       M      14                Barbara     F      13  |
  5  |         James       M      12                Carol       F      14  |
  6  |         Jeffrey     M      13                Jane        F      12  |
  7  |         John        M      12                Janet       F      15  |
  8  |         Philip      M      16                Joyce       F      11  |
  9  |         Robert      M      12                Judy        F      14  |
 10  |         Ronald      M      15                Louise      F      12  |
 11  |         Thomas      M      11                Mary        F      15  |
 12  |         William     M      15                                       |
     +-----+-----------+------+---------+--------+-----------+------+------+

 ____        _       _   _
/ ___|  ___ | |_   _| |_(_) ___  _ __
\___ \ / _ \| | | | | __| |/ _ \| '_ \
 ___) | (_) | | |_| | |_| | (_) | | | |
|____/ \___/|_|\__,_|\__|_|\___/|_| |_|

%utl_submit_r64('
library(XLConnect);
wb &amp;lt;- loadWorkbook("d:/xls/class1.xlsx");
createSheet ( wb , "sheet3" );
prcntg &amp;lt;- createCellStyle(wb);
setDataFormat(prcntg, format = "$00,000.00");
sheet1 = readWorksheet(wb, sheet = getSheets(wb)[1]);
sheet2 = readWorksheet(wb, sheet = getSheets(wb)[2]);
writeWorksheet(wb,sheet1,sheet="sheet3",startCol=1,header=T);
writeWorksheet(wb,sheet2,sheet="sheet3",startCol=6,header=T);
setCellStyle(wb, sheet = "sheet3", row = 1:17, col = 3, cellstyle = prcntg);
setCellStyle(wb, sheet = "sheet3", row = 1:17, col = 7, cellstyle = prcntg);
saveWorkbook(wb,"d:/xls/class1.xlsx");
');
 _     ___   ____
| |   / _ \ / ___|
| |  | | | | |  _
| |__| |_| | |_| |
|_____\___/ \____|

&amp;gt; library(haven);library(XLConnect);males&amp;lt;-read_sas("d:/sd1/males.sas7bdat");
females&amp;lt;-read_sas("d:/sd1/females.sas7bdat");
wb &amp;lt;- loadWorkbook("d:/xls/class_mf.xlsx", create
 = TRUE);createSheet(wb, name = "mf");
writeWorksheet(wb, males, sheet = "mf", startRow = 2, startCol = 2,header=T);
writeWorksheet(wb, females, sheet = "mf", startRow = 2,
startCol = 6,header=T);saveWorkbook(wb);
&amp;gt;
NOTE: 4 lines were written to file PRINT.
Stderr output:
Loading required package: XLConnectJars
XLConnect 0.2-12 by Mirai Solutions GmbH [aut],
  Martin Studer [cre],
  The Apache Software Foundation [ctb, cph] (Apache POI, Apache Commons
    Codec),
  Stephen Colebourne [ctb, cph] (Joda-Time Java library),
  Graph Builder [ctb, cph] (Curvesapi Java library)
http://www.mirai-solutions.com ,
http://miraisolutions.wordpress.com

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Dec 2016 16:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320301#M70520</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2016-12-20T16:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a sas data set into .xls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320302#M70521</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;You can do the following with the IML interface to R

HAVE ( Two SAS Datasets  sashelp.class males and females )

Up to 40 obs from sd1.males total obs=10

Obs    NAME       SEX    AGE

  1    Alfred      M      14
  2    Henry       M      14
  3    James       M      12
  4    Jeffrey     M      13
  5    John        M      12
  6    Philip      M      16
  7    Robert      M      12
  8    Ronald      M      15
  9    Thomas      M      11
 10    William     M      15


Up to 40 obs from sd1.females total obs=9

Obs    NAME       SEX    AGE

 1     Alice       F      13
 2     Barbara     F      13
 3     Carol       F      14
 4     Jane        F      12
 5     Janet       F      15
 6     Joyce       F      11
 7     Judy        F      14
 8     Louise      F      12
 9     Mary        F      15

WANT Excel sheet mf with side by side reports

     ------+-----------+------+---------+--------+-----------+------+------+
EXCEL   A  |     B     |   C  |    D    |   E    |   F       |  G   |  H   |
ROW  +-----+-----------+------+---------+--------+-----------+------+------+
  1  |                                                                     |
  2  |         NAME       SEX    AGE                NAME       SEX    AGE  |
  3  |         Alfred      M      14                Alice       F      13  |
  4  |         Henry       M      14                Barbara     F      13  |
  5  |         James       M      12                Carol       F      14  |
  6  |         Jeffrey     M      13                Jane        F      12  |
  7  |         John        M      12                Janet       F      15  |
  8  |         Philip      M      16                Joyce       F      11  |
  9  |         Robert      M      12                Judy        F      14  |
 10  |         Ronald      M      15                Louise      F      12  |
 11  |         Thomas      M      11                Mary        F      15  |
 12  |         William     M      15                                       |
     +-----+-----------+------+---------+--------+-----------+------+------+

 ____        _       _   _
/ ___|  ___ | |_   _| |_(_) ___  _ __
\___ \ / _ \| | | | | __| |/ _ \| '_ \
 ___) | (_) | | |_| | |_| | (_) | | | |
|____/ \___/|_|\__,_|\__|_|\___/|_| |_|

%utl_submit_r64('
library(XLConnect);
wb &amp;lt;- loadWorkbook("d:/xls/class1.xlsx");
createSheet ( wb , "sheet3" );
prcntg &amp;lt;- createCellStyle(wb);
setDataFormat(prcntg, format = "$00,000.00");
sheet1 = readWorksheet(wb, sheet = getSheets(wb)[1]);
sheet2 = readWorksheet(wb, sheet = getSheets(wb)[2]);
writeWorksheet(wb,sheet1,sheet="sheet3",startCol=1,header=T);
writeWorksheet(wb,sheet2,sheet="sheet3",startCol=6,header=T);
setCellStyle(wb, sheet = "sheet3", row = 1:17, col = 3, cellstyle = prcntg);
setCellStyle(wb, sheet = "sheet3", row = 1:17, col = 7, cellstyle = prcntg);
saveWorkbook(wb,"d:/xls/class1.xlsx");
');
 _     ___   ____
| |   / _ \ / ___|
| |  | | | | |  _
| |__| |_| | |_| |
|_____\___/ \____|

&amp;gt; library(haven);library(XLConnect);males&amp;lt;-read_sas("d:/sd1/males.sas7bdat");
females&amp;lt;-read_sas("d:/sd1/females.sas7bdat");
wb &amp;lt;- loadWorkbook("d:/xls/class_mf.xlsx", create
 = TRUE);createSheet(wb, name = "mf");
writeWorksheet(wb, males, sheet = "mf", startRow = 2, startCol = 2,header=T);
writeWorksheet(wb, females, sheet = "mf", startRow = 2,
startCol = 6,header=T);saveWorkbook(wb);
&amp;gt;
NOTE: 4 lines were written to file PRINT.
Stderr output:
Loading required package: XLConnectJars
XLConnect 0.2-12 by Mirai Solutions GmbH [aut],
  Martin Studer [cre],
  The Apache Software Foundation [ctb, cph] (Apache POI, Apache Commons
    Codec),
  Stephen Colebourne [ctb, cph] (Joda-Time Java library),
  Graph Builder [ctb, cph] (Curvesapi Java library)
http://www.mirai-solutions.com ,
http://miraisolutions.wordpress.com

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 16:52:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320302#M70521</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2016-12-20T16:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a sas data set into .xls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320303#M70522</link>
      <description>I posted the wrong solution code&lt;BR /&gt;&lt;BR /&gt;Here is the correct code</description>
      <pubDate>Tue, 20 Dec 2016 16:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320303#M70522</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2016-12-20T16:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a sas data set into .xls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320304#M70523</link>
      <description>libname sd1 "d:/sd1";&lt;BR /&gt;data sd1.males sd1.females;&lt;BR /&gt;set sashelp.class(keep=name sex age);&lt;BR /&gt;if sex='M' then output sd1.males;&lt;BR /&gt;else output sd1.females;&lt;BR /&gt;run;quit;&lt;BR /&gt;&lt;BR /&gt;%utlfkil(d:/xls/class_mf.xlsx);&lt;BR /&gt;%utl_submit_r64('&lt;BR /&gt;library(haven);&lt;BR /&gt;library(XLConnect);&lt;BR /&gt;males&amp;lt;-read_sas("d:/sd1/males.sas7bdat");&lt;BR /&gt;females&amp;lt;-read_sas("d:/sd1/females.sas7bdat");&lt;BR /&gt;wb &amp;lt;- loadWorkbook("d:/xls/class_mf.xlsx", create = TRUE);&lt;BR /&gt;createSheet(wb, name = "mf");&lt;BR /&gt;writeWorksheet(wb, males, sheet = "mf", startRow = 2, startCol = 2,header=T);&lt;BR /&gt;writeWorksheet(wb, females, sheet = "mf", startRow = 2, startCol = 6,header=T);&lt;BR /&gt;saveWorkbook(wb);&lt;BR /&gt;');&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Dec 2016 16:53:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320304#M70523</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2016-12-20T16:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a sas data set into .xls</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320544#M70627</link>
      <description>| | / _ \ / ___|&lt;BR /&gt;&lt;BR /&gt;| | | | | | | _&lt;BR /&gt;&lt;BR /&gt;| |__| |_| | |_| |&lt;BR /&gt;&lt;BR /&gt;|_____\___/ \____|&lt;BR /&gt;&lt;BR /&gt;WARNING: Apparent invocation of macro UTL_SUBMIT_R64 not resolved.&lt;BR /&gt;486 %utl_submit_r64('&lt;BR /&gt;-&lt;BR /&gt;180&lt;BR /&gt;NOTE: The quoted string currently being processed has become more than 262 characters long. You&lt;BR /&gt;might have unbalanced quotation marks.&lt;BR /&gt;&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Dec 2016 16:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-sas-data-set-into-xls/m-p/320544#M70627</guid>
      <dc:creator>Vladimir</dc:creator>
      <dc:date>2016-12-21T16:17:19Z</dc:date>
    </item>
  </channel>
</rss>

