Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
%macro export_to_excel();
%local varlist idx var;
proc sql noprint;
select distinct sex into: varlist separated by '||'
from sashelp.class;
quit;
%let idx = 1;
%do %while ( %scan(&varlist, &idx, %str(||)) ne %str() );
%let var=%scan(&varlist, &idx, %str(||));
proc export data=sashelp.class (where=(sex="&var"))
outfile='c:\temp\Femalelist.xls'
dbms=excel;
sheet="&var";
quit;
%let idx = %eval(&idx + 1);
%end;
%mend export_to_excel;
%export_to_excel;
<t
h align="right">
field = compress(field,'0D'x '0A'x);
<td align=ri
ght>
<td align=right>
proc options;
run;
ODS CHTML FILE=EXCEL RS=NONE
HEADTEXT="<STYLE> TD {MSO-NUMBER-FORMAT:\@}</STYLE>";
TITLE;
PROC PRINT DATA=EMPS_IN NOOBS;
RUN;
ODS CHTML CLOSE;
ODS TAGSETS.MSOFFICE2K FILE=FILENAME_HERE RS=NONE STYLE=SASDOCPRINTER
HEADTEXT="<STYLE> TD {MSO-NUMBER-FORMAT:\@}</STYLE>";
TITLE;
PROC PRINT DATA=EMPS_IN NOOBS;
RUN;
ODS TAGSETS.MSOFFICE2K CLOSE;
ods tagsets.excelxp file="P:\Clients\Active\xxxx\reports\xxxx_&RUNDT..xls"
options(absolute_column_width='10,10,10,10,8,8,8,8,8,8,8,8,8,8'
row_repeat='header'
embedded_titles='yes'
frozen_headers='yes'
scale='100'
orientation='landscape'
sheet_name='Report'
)
style=styles.psexcel;
... report...
ODS tagsets.excelxp close;
*Set ODS Path to only store stylesheet for the session. *;
*ods path work.templat(update) sashelp.tmplmst(read) ;
ods path sashelp.tmplmst(update) ;
* Stylesheet for standard colours etc. *;
proc template;
define style Styles.PSExcel;
parent = styles.default;
style SystemTitle from SystemTitle /
background = #FFFFFF
foreground = #000000
font_style = Roman
font_weight = Bold
font_size = 4
font_face = "Arial, Helvetica, Sans Serif";
style SystemFooter from SystemFooter /
background = #FFFFFF
foreground = #000000
font_style = Italic
font_weight = Bold
font_size = 3
font_face = "Arial, Helvetica, Sans Serif";
style SysTitleAndFooterContainer from SysTitleAndFooterContainer /
borderwidth = 0
background = #FFFFFF
foreground = #FFFFFF
font_style = Italic
font_weight = Bold
font_size = 3
font_face = "Arial, Helvetica, Sans Serif";
style Body from Body /
rightmargin = 8px
leftmargin = 8px
background = #FFFFFF
foreground = #000000
font_style = Roman
font_weight = Medium
font_size = 2
font = ("Arial, Helvetica, Sans Serif")
topmargin=0.75in
bottommargin=0.75in
leftmargin=0.75in
rightmargin=0.75in;;
style RowHeader from RowHeader /
background = #99CCFF
foreground = #000000
font_style = Roman
font_weight = Bold
font_size = 2
font = ("Arial, Helvetica, Sans Serif")
vjust = Top
borderwidth = 2px
bordercolor = #000000;
style Header from Header /
background = #99CCFF
bordercolor = #000000
borderwidth = 2px
foreground = #000000
font_style = Roman
font_weight = Bold
font_size = 2
just = center
vjust = bottom
font = ("Arial, Helvetica, Sans Serif");
style Data from Data /
borderwidth = 2px
bordercolor = #000000
background = #FFFFFF
foreground = #000000
font_style = Roman
font_weight = Medium
font_size = 2
font = ("Arial, Helvetica, Sans Serif");
style dataemphasis from dataemphasis /
borderwidth = 3px
bordercolor = #000000
background = #99CCFF
foreground = #000000
font_style = Roman
font_weight = BOLD
font_size = 2
font = ("Arial, Helvetica, Sans Serif");
style Table from Table /
cellspacing = 1px
bordercolor = #000000
borderwidth = 1px
background = #FFFFFF
foreground = #000000
font_style = Roman
font_weight = Medium
font_size = 2
font = ("Arial, Helvetica, Sans Serif");
end;
run;
<Cell ss:StyleID="Data" ss:Index="1"><Data ss:Type="Number">012345678</Data></Cell>
<Cell ss:StyleID="Data" ss:Index="1"><Data ss:Type="String">012345678</Data></Cell>
VAR FIELD_NAME / STYLE={TAGATTR='000000000'};
ChrisW75 said:The problem as it was explained to me by the guy who wrote the EXCELXP tagset is that most of the output procedures output the data only, no metadata, so the ODS tagsets have to try to determine what the data is before they convert it. If there are no characters in the field other than numerics, then ODS has to take it as a numeric.