Sample 25269: Creating a macro variable containing a long number
PROC SQL supports the creation of macro variables using the SELECT /
INTO: clause. The length of the macro variable's value is taken from
the length of the column used to create the macro variable.
A FORMAT= column modifier can be supplied to increase the length of
the macro variable.
Supplying a numeric format, of sufficient length, can prevent long
numeric values from being written to the macro variable in scientific
notation.
The statement: %put &mac_var;
Writes the contents of the macro variable "mac_var" to the SAS log.
The NOPRINT option prevents the SELECT clause from writing to the
Output Window, which is the default action of the SELECT statement.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
data one;
x=98765432123456;
run;
proc sql noprint;
select x format=16. into :mac_var
from one;
quit;
%put &mac_var;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This example illustrates the use of PROC SQL and the SELECT / INTO:
clause, with a FORMAT= column modifier, to create a macro variable containing a long number.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> SQL
|
| Date Modified: | 2005-03-19 03:02:39 |
| Date Created: | 2005-03-17 10:51:28 |
Operating System and Release Information
| SAS System | Base SAS | All | n/a | n/a |