Date: Thu, 10 Feb 2005 14:17:33 +0100
Reply-To: Andre Wielki <wielki@INED.FR>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Andre Wielki <wielki@INED.FR>
Subject: Re: Excel Workbook
In-Reply-To: <C5BBF9D77CC16D47AD1750931C5FC8624D941E@kenmsg15.us.schp.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Bosch, Jules wrote:
> SAS V8.2
> W2K
>
> I have three separate SAS data sets that I would like to export to Excel and
> end up with three spreadsheets in an Excel workbook. How may I accomplish
> this with SAS?
>
> TIA,
>
> Jules Bosch
>
>
> *********************************************************************
> This message and any attachments are solely for the intended recipient. If you are not the intended recipient, disclosure, copying, use or distribution of the information included in this message is prohibited -- Please immediately and permanently delete.
>
Jules
You must read again the chevell texts
To help you here is a sample (tested) you have to adapt it
(economy of typing code!) isn'it?
ods listing close;
title;
ods html file="c:\temp\t1.html" style=minimal;
*ods phtml file="c:\temp\t1.html";
proc freq data=sasuser.fitness;
tables runtime;
run;
ods html close;
*ods phtml file="c:\temp\t2.html";
ods html file="c:\temp\t2.html" style=minimal;
proc freq data=sasuser.fitness;
tables runpulse;
run;
ods html close;
*ods phtml file="c:\temp\t3.html";
ods html file="c:\temp\t3.html" style=minimal;
proc freq data=sasuser.fitness;
tables group;
run;
ods html close;
proc template;
define tagset tagsets.testmultiple;
parent=tagsets.phtml;
define event doc;
start:
put '<html xmlns:o="urn:schemas-microsoft-com:office: office"' NL;
put 'xmlns:x="urn:schemas-microsoft-com:office:excel"' NL;
put 'xmlns="http://www.w3.org/TR/REC-html40">' NL;
finish:
put "</html>" NL;
end;
define event doc_head;
start:
put "<head>" NL;
put '<meta name="Excel Workbook Frameset">';
put '<meta http-equiv=Content-Type content="text/html; charset=windows-1252">';
put '<meta name=ProgId content=Excel.Sheet>';
put '<meta name=Generator content="Microsoft Excel 9">';
finish:
put "<!--[if gte mso 9]><xml>" NL;
put "<x:ExcelWorkbook>" NL;
put " <x:ExcelWorksheets>" NL;
put " <x:ExcelWorksheet>" NL;
put " <x:Name>runtime</x:Name>" NL;
put " <x:WorksheetSource HRef='c:\temp\t1.html'/>" NL;
put " </x:ExcelWorksheet>" NL;
put " <x:ExcelWorksheet>" NL;
put " <x:Name>runpulse</x:Name>" NL;
put " <x:WorksheetSource HRef='c:\temp\t2.html'/>" NL;
put " </x:ExcelWorksheet>" NL;
put " <x:ExcelWorksheet> " NL;
put " <x:Name>group</x:Name>" NL;
put " <x:WorksheetSource HRef='C:\temp\t3.html'/>" NL;
put " </x:ExcelWorksheet>" NL;
put " </x:ExcelWorksheets>" NL;
put "<x:WindowHeight>5000</x:WindowHeight>" NL;
put " <x:WindowWidth>10380</x:WindowWidth>" NL;
put "<x:WindowTopX>480</x:WindowTopX>" NL;
put "<x:WindowTopY>45</x:WindowTopY>" NL;
put "<x:ActiveSheet>3</x:ActiveSheet>" NL;
put "<x:ProtectStructure>False</x:ProtectStructure>" NL;
put "<x:ProtectWindows>False</x:ProtectWindows>" NL;
put "</x:ExcelWorkbook>" NL;
put "</xml><![endif]-->" NL;
put "</head>" NL;
end;
end;
run;
ods markup file="c:\temp\odshtmlmult.xls"
tagset=tagsets.testmultiple stylesheet="c:\temp\temp.css";;
data _null_;file print;
put ;
run;
ods markup close;
ods listing;
--
Andre Wielki
INED (Institut National d'Etudes Démographiques)
133 Boulevard Davout 75980 Paris Cedex 20
33 (0) 1 56 06 21 54 FRANCE