Hi:
This is not really an ODS or reporting procedure question. However, when you use the DATA step and CALL SYMPUT to make your macro variables, you are responsible for trimming the data step variables yourself.
My preferred method is to just use %SUBSTR and the %LET -- which the macro facility usually trims for you. Compare the LOG (and the %PUT output) for both of these examples. For more help with the Macro coding, contact Tech Suport.
cynthia
[pre]
*** 1) only use %LET and %SUBSTR;
*** use %LET statement and NOT datastep;
*** %LET will strip trailing blanks for you;
%LET project= XY_ABCD0021_XXXX;
%GLOBAL project repnum business ;
%put ------->;
%let repnum = %substr(&project,1,11);
%put &repnum;
%let business = %substr(&project,1,2);
%put &business;
%let newname = &repnum..txt;
%put &newname (without any "trim");
%put ------->;
FILENAME outfile "c:\temp\&repnum..txt";
PROC PRINTTO FILE=outfile NEW;
RUN;
proc print data=sashelp.class;
title "will be saved to &repnum..txt";
run;
proc printto; run;
*** 2) Use DATA step and SYMPUT, but use TRIM function, too.;
%LET project= ZZ_ZYXW0042_AAAA;
DATA _NULL_;
repnum2=substr("&project",1,11);
business2=substr("&project",1,2);
CALL SYMPUT("repnum2",trim(repnum2));
CALL SYMPUT("business2",trim(business2));
RUN;
%put -------> using trim function with call symput;
%put &repnum2;
%put &business2;
%let newname2 = &repnum2..txt;
%put &newname2 (with "trim" and call symput);
%put ------->;
FILENAME outfile2 "c:\temp\&repnum2..txt";
PROC PRINTTO FILE=outfile2 NEW;
RUN;
proc print data=sashelp.class;
title "will be saved to &repnum2..txt";
run;
proc printto; run;
[/pre]