In reply to Rune Piil.

%macro RGB2CX(r,g,b);
CX%sysfunc(putn(&r.,hex2.))%sysfunc(
putn(&g.,hex2.))%sysfunc(putn(&b.,hex2.))
%mend;

does the trick.