DATA Step, Macro, Functions and more

Assign format to a MACRO value

Reply
N/A
Posts: 0

Assign format to a MACRO value

Would that be possible to assign a format to the value by using Symput (or similarly in PROC SQL).

Here is an example:
PROC SQL noprint;
select min(EN) into :minEN;
from test;
QUIT;

The minimum value of EN is 10.12345. The above program works perfectly to get the exact value but can I assign a format like COMMA8.2 to change it to 10.12?
Super Contributor
Super Contributor
Posts: 3,174

Re: Assign format to a MACRO value

Posted in reply to deleted_user
With the DATA step approach and SYMPUT, you would use the PUT function in the SYMPUT call to generate a "formatted" value. And with the PROC SQL approach, the FORMAT= keyword is added to the SELECT to generate a formatted value.

Scott Barry
SBBWorks, Inc.
Super Contributor
Posts: 359

Re: Assign format to a MACRO value

Posted in reply to deleted_user
PROC SQL noprint;
select put(min(EN), comma8.2) into :minEN;
from test;
QUIT;
Ask a Question
Discussion stats
  • 2 replies
  • 123 views
  • 0 likes
  • 3 in conversation