Tuesday, January 22, 2013

SAS: Left-align a macro value

I write various data to a process log as name-value pairs.  Sometimes the "values" are character and sometimes they are numeric, so they are defined as character in the database.  I want the "values" to be left-aligned regardless of type.  The name-value pairs are appended to the log via a macro which uses an INSERT statement within PROC SQL.  For some unknown reason, I was unable to use trim(left(x)) in the INSERT statement.  But I stumbled upon a format option which allows left / right / center justification:

%append_to_process_log("#output", put(&OUT, 10. -l));


No comments:

Post a Comment