The SAS Output Delivery System and reporting techniques

Keep leading 0 when exporting to excel via tagsets.excelxp

Reply
Contributor
Posts: 34

Keep leading 0 when exporting to excel via tagsets.excelxp

Hi

I want to keep the leading 0 when I am exporting to excel through tagsets.excelxp. I try to use the format @ but it doesn´t work. Any ideas?
data ett;
text = '05566';
run;


ods path SASUSER.TEMPLAT(UPDATE) SASHELP.TMPLMST(READ) SASHELP.TEMPLAT(READ);

ods tagsets.excelxp file="/sas/sasdata/MAExports/test.xls" ;


proc print data = ett;
;
var text/style(data)={tagattr="format:@"}; ;
run;

ods tagsets.close;

ods path SASUSER.TEMPLAT(READ) SASHELP.TMPLMST(READ) SASHELP.TEMPLAT(READ);
SAS Employee
Posts: 95

Re: Keep leading 0 when exporting to excel via tagsets.excelxp

this actually does work, although Excel still puts a flag on the value because it wants to convert it to a number.

The @ format causes the tagset to automatically set the type to String, and the format to '@'.

If you don't like the little flags, then you might want to try using a number format that will preserve the leading zeros.

format:00000

Should do the trick for this example.

Eric
Ask a Question
Discussion stats
  • 1 reply
  • 135 views
  • 0 likes
  • 2 in conversation