The SAS Output Delivery System and reporting techniques

Get dagger symbol from within text in SAS to output in Excel

Reply
N/A
Posts: 0

Get dagger symbol from within text in SAS to output in Excel

Hi all,

I need to enter a dagger symbol † into the title (or header/footer) of an Excel file that is being produced in SAS EG. I have tried pasting the symbol directly into SAS, however this causes the program to error. I have then tried using an escapechar which displayed the dagger in the SAS output, but not in the Excel output. I have a feeling that that is heading in the right direction however can't quite get it right...

I am using SAS EG and Excel 2003.

The following is part of the ods code that I am using:


ods rtf close;
options ls=250;
ods tagsets.ExcelXP file="&base/dm/cechkpat_&sysdate9..xls" style=sansprinter;

ods tagsets.ExcelXP options(embedded_titles='yes' sheet_name=&dsname
absolute_column_width= &colwidths
frozen_headers='5');

title1 "SPACE 12918 listing creation date: &sysdate9.";
title2 "DM SAS Edit Checks [enter dagger here] ";
title3 &dsname;

proc print data=&dsin label u noobs;
var _all_;
run;


In bold is where I require the dagger to appear. I'd be really grateful if anyone can help with this problem! And do let me know if you need me to try and clarify further.

Many thanks in advance,
Katie
SAS Employee
Posts: 174

Re: Get dagger symbol from within text in SAS to output in Excel

Posted in reply to deleted_user
Katie,

You ought to be able to use inline formatting to get the dagger symbol, but it didn't work in SAS 9.2 when I tried it. Please contact Technical Support by clicking on the "Contact Us" link at the bottom of this page.

-- David Kelley, SAS

[pre]
ods escapechar='^';
ods tagsets.excelxp options(embedded_titles="yes") file="dagger.xls";
title "Hello World ^{unicode 2020}";
proc print data=sashelp.class;
run;
ods _all_ close;
[/pre]
SAS Super FREQ
Posts: 8,868

Re: Get dagger symbol from within text in SAS to output in Excel

Posted in reply to deleted_user
Hi:
I do not have Excel 2003 to test with. So you might have to go to Tech Support if the following suggestion does not work. I discovered that ODS ESCAPECHAR methods of inserting a {dagger} do not appear to work with TAGSETS.EXCELXP.

However, once I corrected the errors in the suboption list (all suboptions must be quoted), inserting a dagger symbol that I had pasted from elsewhere only needed a specific font (such as Arial Unicode MS) to work (in Excel 2010).

As you can see in the code below, the HTML "flavor" uses all 3 methods of inserting a dagger symbol. However, the XML "flavor" only uses the TITLE2 method (cut and paste). ODS MSOFFICE2K produces HTML output that Excel knows how to open and render. ODS TAGSETS.EXCELXP produces Spreadsheet 2003 XML that Excel knows how to open and render. Clearly, Excel is happiest, in the XML, using a cut and pasted dagger symbol.

For specific Excel 2003 questions and TAGSETS.EXCELXP questions, you might have to work with Tech Support.

cynthia
[pre]
ods _all_ close;

%let sh = wombat;
%let colwidth=10;


ods msoffice2k file="c:\temp\dagger_mso.xls" style=sansprinter;
ods tagsets.ExcelXP file="c:\temp\dagger_xp.xls" style=sansprinter;
ods escapechar='^';
ods tagsets.ExcelXP options(embedded_titles='yes' sheet_name="&sh"
embedded_footnotes='yes'
absolute_column_width= "&colwidth"
frozen_headers="7");

title1 c=black h=14pt f="Arial Unicode MS" "For XP, only title 2 uses dagger symbol";
title2 c=black f="Arial Unicode MS" h=14pt "Is this a dagger I see before me? † ";
title3 c=black f="Arial Unicode MS" h=14pt "&sysdate9. and Something Else ^{dagger}";
title4 c=black f="Arial Unicode MS" h=14pt "Insert Unicode ^{unicode 2020} (feature SAS 9.2)";

footnote "title2, 3 and 4 all work in ODS MSOFFICE2K HTML-based destination";
proc print data=sashelp.class(obs=3) label u noobs;
var _all_;
run;
ods _all_ close;
[/pre]
N/A
Posts: 0

Re: Get dagger symbol from within text in SAS to output in Excel

Posted in reply to deleted_user
Hi guys,

Many thanks for your help. Unfortunately the code still doesn't seem to work with Excel 2003 - so I shall contact Tech Support later on.

Thanks again,
Katie
Ask a Question
Discussion stats
  • 3 replies
  • 1176 views
  • 0 likes
  • 3 in conversation