To circumvent the problem, use an update to the ExcelXP tagset, and maintain leading blanks with the non-breaking space character  . This is demonstrated on the Full Code tab.
An alternative is to use the MSOffice2K tagset, which does preserve leading blanks. Sample code is also shown on the Full Code tab.
Product Family | Product | System | SAS Release | |
Reported | Fixed* | |||
SAS System | Base SAS | z/OS | 9.1 TS1M3 SP4 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |||
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |||
Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |||
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |||
Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |||
Windows Vista | 9.1 TS1M3 SP4 | |||
Windows Vista for x64 | 9.1 TS1M3 SP4 | |||
64-bit Enabled AIX | 9.1 TS1M3 SP4 | |||
64-bit Enabled HP-UX | 9.1 TS1M3 SP4 | |||
64-bit Enabled Solaris | 9.1 TS1M3 SP4 | |||
HP-UX IPF | 9.1 TS1M3 SP4 | |||
Linux | 9.1 TS1M3 SP4 | |||
Linux on Itanium | 9.1 TS1M3 SP4 | |||
OpenVMS Alpha | 9.1 TS1M3 SP4 | |||
Solaris for x64 | 9.1 TS1M3 SP4 | |||
Tru64 UNIX | 9.1 TS1M3 SP4 |
The second workaround illustrates the use of the MSOffice2K tagset. The ORIGIN values ASIA and USA are indented slightly using the PRETEXT= style setting. These leading blanks are maintained with the ASIS=ON style attribute setting. In order to prevent tall cell heights, the HEADTEXT= option is necessary in the ODS TAGSETS statement.
/* Workaround using the ExcelXP tagset */
proc template;
define tagset tagsets.excelxp_mod;
parent=tagsets.excelxp;
/**************************************************************************/
/* Add the PRETEXT and the POSTEXT= style variable to the VALUE_PUT event */
/**************************************************************************/
define event value_put;
open row;
do /if ^$value_put;
do /if cmp( event_name, "header");
trigger value_type;
set $tmp_val strip(value);
set $type "String" /if ^$tmp_val;
unset $tmp_val;
done;
putq "<Data ";
do /if $value;
putq "ss:Type=" $type;
else;
putq "ss:Type=""String""";
done;
put ">";
set $value_put "true";
unset $type;
done;
put pretext;
put $value;
put posttext;
unset $value;
end;
end;
run;
ods tagsets.excelxp_mod file="excelxp.xls";
proc report data=sashelp.cars nowd;
col origin cylinders mpg_highway mpg_city;
define origin / group;
define cylinders / group;
define mpg_highway / mean format=4.;
define mpg_city / mean format=4.;
compute origin;
if origin ne "Europe" then do;
call define(_col_,"style","style={pretext=' '}");
end;
endcomp;
run;
ods _all_ close;
/* Workaround using the MSOffice2K tagset */
ods tagsets.msoffice2k file='msoffice2k.xls' headtext="<style> pre {margin:0}</style>" ;
proc report data=sashelp.cars nowd;
col origin cylinders mpg_highway mpg_city;
define origin / group;
define cylinders / group;
define mpg_highway / mean format=4.;
define mpg_city / mean format=4.;
compute origin;
if origin ne "Europe" then do;
call define(_col_,"style","style={pretext=' ' asis=on}");
end;
endcomp;
run;
ods _all_ close;
Type: | Usage Note |
Priority: | medium |
Date Modified: | 2011-11-17 14:19:58 |
Date Created: | 2011-08-26 13:14:46 |