<?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: while exporting multiple datasets from library to excel how can i have titles as well in the she in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/while-exporting-multiple-datasets-from-library-to-excel-how-can/m-p/723896#M224720</link>
    <description>&lt;P&gt;Additionally you need TITLE and/or FOOTNOTE statements.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Mar 2021 16:22:03 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-03-05T16:22:03Z</dc:date>
    <item>
      <title>while exporting multiple datasets from library to excel how can i have titles as well in the sheets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/while-exporting-multiple-datasets-from-library-to-excel-how-can/m-p/723843#M224696</link>
      <description>&lt;P&gt;I am trying to export multiple datasets in work library to excel with different sheets and it works fine, But i also want to have titles in top of each sheet. tried proc print but didnt work, any help on how to get it.&lt;/P&gt;
&lt;P&gt;My sample code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/*-Check for identifying missing LBSTRESC records while LBSTRESU is not
missing-*/
proc sort data =sdtm.lb
	(where=((LBSTRESC eq "" and LBSTRESU ne "") or (LBORRES eq "" and
	LBORRESU ne "" ))) tagsort nodupkey
	out = check12(keep = LBTEST LBTESTCD LBSTRESU LBORRESU LBORRES LBSTRESC);
	by LBTEST LBTESTCD LBSTRESU LBORRESU;
run;

data check12;
	set check12;
	by LBTEST LBTESTCD;

	if first.LBTEST ne last.LBTEST then
		put "ALERT_R: Units are populated while results are missing" LBTEST
		"Requires review";
run;
title1 "Check for identifying missing LBSTRESC records while LBSTRESU is not
missing";
proc pint data=check12; run;&lt;BR /&gt;
/*-Check for identifying missing LBORRESU records while LBORRES is provided*/
data check13;
	set sdtm.lb;
	lborresn = input(lborres,??best.);

	if lborresn ne . and lborresu = ' ';
	put "Alert_R:" USUBJID " have records with reported result that has numeric
		result values but do not have corresponding unit";
run;


proc template;
	define style mystyle;
		parent = styles.default
		;
		style body from body /
			topmargin=.5in
			bottommargin=.5in
			leftmargin=.5in
			rightmargin=.5in
		;
		style table from table /
			foreground = black
			font_face = 'arial'
			font_size = 10pt
			just = center
			font_weight = bold
			borderwidth = 1
			vjust = center
			bordercolor = black
		;
		style header from header /
			foreground = black
			font_face = 'arial'
			font_size = 10pt
			just = center
			font_weight = bold
			borderwidth = 1
			vjust = top
			bordercolor = black
		;
		style data from data /
			background = white
			foreground = black
			font_face = 'arial'
			vjust = center
			just = center
			font_size = 10pt
			borderwidth = 1
			bordercolor = black
		;
	end;
quit;

%macro excel (lib=,file_loc=);

	proc sql noprint;
		select count(memname) into: memname_cnt
			from dictionary.members
				where upcase(libname)="&amp;amp;lib";
		select memname into: sasdata1 - : sasdata%eval(&amp;amp;memname_cnt)
			from dictionary.tables
				where upcase(libname)="&amp;amp;lib"
					and upcase(memname) not in ('FREEZE_DATE','LOG','TEMP');
		%let num_sasdata=&amp;amp;sqlobs;
	quit;

	ods tagsets.excelxp file="&amp;amp;file_loc"
		options(autofit_height='yes' wraptext='no' frozen_headers='1' row_repeat='1'
		orientation='landscape' column_repeat='1' center_horizontal='yes'
		absolute_column_width='20') style=mystyle;

	%do x = 1 %to &amp;amp;num_sasdata;
		ods tagsets.excelxp options(sheet_name="&amp;amp;&amp;amp;sasdata&amp;amp;x");

		proc report data=&amp;amp;lib..&amp;amp;&amp;amp;sasdata&amp;amp;x nowd missing;
		run;

		quit;

	%end;

	ods tagsets.excelxp close;
	ods listing;
%mend;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Mar 2021 11:20:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/while-exporting-multiple-datasets-from-library-to-excel-how-can/m-p/723843#M224696</guid>
      <dc:creator>noda6003</dc:creator>
      <dc:date>2021-03-05T11:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: while exporting multiple datasets from library to excel how can i have titles as well in the she</title>
      <link>https://communities.sas.com/t5/SAS-Programming/while-exporting-multiple-datasets-from-library-to-excel-how-can/m-p/723853#M224702</link>
      <description>&lt;P&gt;In your options for ODS ... EXCELXP consider using these options:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="357"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="170"&gt;EMBEDDED_FOOTNOTES&lt;/TD&gt;
&lt;TD width="187"&gt;Put footnotes in the worksheet&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;EMBEDDED_TITLES&lt;/TD&gt;
&lt;TD&gt;Put titles in the worksheet&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See&amp;nbsp;&lt;A href="https://support.sas.com/rnd/base/ods/odsmarkup/excelxp_help.html" target="_blank"&gt;Base SAS: Quick Reference for TAGSETS.EXCELXP Tagset | SAS Support&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 13:00:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/while-exporting-multiple-datasets-from-library-to-excel-how-can/m-p/723853#M224702</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-03-05T13:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: while exporting multiple datasets from library to excel how can i have titles as well in the she</title>
      <link>https://communities.sas.com/t5/SAS-Programming/while-exporting-multiple-datasets-from-library-to-excel-how-can/m-p/723896#M224720</link>
      <description>&lt;P&gt;Additionally you need TITLE and/or FOOTNOTE statements.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 16:22:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/while-exporting-multiple-datasets-from-library-to-excel-how-can/m-p/723896#M224720</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-05T16:22:03Z</dc:date>
    </item>
  </channel>
</rss>

