SAS Macro Space


SAS Day 25: Marco Space Trick


Last time, we did a little summary of the Space Function in SAS.
Generally, it is enough, however, what if we want to manipulate the space inside a Macro?
the general space function such as Trim, Compress, Compbl, Strip would NOT work sometime.

Daria-Yakovleva / Pixabay



 We want to remove the extra empty space in the PDF output table format



Because of the “N” is written in a macro. so we will use 

%qcmpres or %trim

column="Total~ (N=%qcmpres(&N))~ n(%)// width= 40 left ";
column="Total~ (N=%trim(&N))~ n(%)// width= 40 left ";




Now we have the desired neat output!


Thanks very much to Sun Jian and CJ told me the trick!

Happy Practicing! 😝



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social media & sharing icons powered by UltimatelySocial
%d bloggers like this: