Michael:
I could not find a link to the example I was thinking of, but here's the code to do what you want. It is a custom tagset template, so it will only work to generate HTML tags. What is happening is that the tagset is testing the variable as ODS sends it to see if the type="string" and if that test is true, then the spaces are being converted to the HTML entity   -- which has the same effect as turning nobreakspace=on for character variables. Since the default for nobreakspace is OFF, this means that your numeric variables would still use this default. Here's the code.
cynthia
[pre]
ods path work.custom(update)
sashelp.tmplmst(read);
**;
** create a char var with spaces in the value;
data newclass;
length newname $70 name $15;
set sashelp.class;
newname = trim(name)||' Wombat';
if sex = 'M' then name = trim(name)||' '||'Bob';
else name = trim(name)||' '||'Ann';
run;
**;
** now define a custom tagset to test whether;
** the variable is a character variable;
** type="string";
** and if so, use the tranwrd function to turn all;
** occurrences of space char into entity;
** which has the same -effect- as nobreakspace=on;
** the testing takes place in the tagset before;
** the value is written to the HTML file;
proc template;
define tagset tagsets.char_nbsp;
parent=tagsets.html4;
define event table ;
start:
put '
' nl;
end;
define event row;
start:
putq '' nl;
finish:
put '' nl;
end;
define event data;
start:
put '
trigger classalign;
put '>';
do /if cmp(type, 'string');
put tranwrd(value, ' ', ' ');
else;
put value;
done;
finish:
put '' nl;
end;
end;
run;
** use the new tagset;
ods tagsets.char_nbsp file="forum_nbsp.html";
proc print data=newclass;
title 'use HTML custom tagset to turn spaces into ';
title2 'do a view --> source in browser to see conversion in data values';
var name newname age height weight;
run;
ods _all_ close;
[/pre]