I can't seem to remove trailing spaces in a macro variable created from within PROC SQL. A LENGTH can be assigned to the variable in the SELECT statement to force the effect but only if I know the length ahead of time does that make sense to do. The same situation for text variables. I have been creating the data set variable in PROC SQL and then using a DATA step with CALL SYMPUT to create the macro variable. That works but adds unnecessary lines of code. Here is the new code I want to use: DATA d20140711; INPUT VAR1; DATALINES; 1 20 300 4000 50000 ; RUN; PROC SQL NOPRINT; SELECT COMPRESS(PUT(AVG(VAR1), BEST.), ' ') INTO : VAR1_AVG FROM d20140711; QUIT; %PUT [VAR1_AVG=&VAR1_AVG]; The SAS log contains this text: [VAR1_AVG=10864.2 ]
... View more