See if this gives you a hint:
proc format library=work;
value $sex
'F' = 'Female'
'M' = 'Male'
;
run;
data demo;
set mxpulseweight;
length text $ 100;
text = catx(' ','Mean for',variable, put(sex,$sex.),'is',mean);
run;
the Catx is one example of what was intended for concatenation.
The (very minor) trick is to get the sex mismatched and variables linked and avaialbe on a single row. There are probably at least 5 realtively easy ways depending on the approach chosen. Since this sounds a lot like homework you'll learn more by at least attempting something and if you don't get the result then provide examples of what you did, the logic you were attempting to use and the result you actually received.
You might examine what your mxpulseweight data set looks like if you sort by varaible and then sex for one approach.
... View more