Help using Base SAS procedures

Use Macro for table name

Reply
SAS Employee
Posts: 17

Use Macro for table name

how we can change the Table name with the help of Macro.
like I want name like this
TABLE HUB_SANC FROM HUB_MIS
TABLE STATE_SANC FROM STATE_MIS
Super Contributor
Super Contributor
Posts: 3,174

Re: Use Macro for table name

You can use a %LET statement to substitute a value using a macro variable name. Or if you have a macro, then you can invoke the macro supplying a macro variable value in parentheses.

Scott Barry
SBBWorks, Inc.

Introduction to the Macro Facility
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a002293969.htm
SAS Employee
Posts: 17

Re: Use Macro for table name

WHEN I am using

%LET A= BANK;

THEN I got following error.
Please check let me know how I can change the name of my table



47 PROC SQL;
48 CREATE TABLE &A_MASTER_TO_DUMP AS SELECT DISTINCT (SUM(ACTUAL_DISBURSAL/10000000)) AS
_
22
________________
202
48 ! DISBURSAL,COUNT(ACTUAL_DISBURSAL)AS DISBURSE_COUNT,
WARNING: Apparent symbolic reference A_MASTER_TO_DUMP not resolved.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string.

ERROR 202-322: The option or parameter is not recognized and will be ignored.

49 ADM1,Zone,Cluster,SOL_ID
50 FROM &A_MASTER_TO
WARNING: Apparent symbolic reference A_MASTER_TO not resolved.
50 FROM &A_MASTER_TO
_
22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, CONNECTION, DICTIONARY.
3 The SAS System 09:50 Monday, August 10, 2009


50 FROM &A_MASTER_TO
___________
202
ERROR 202-322: The option or parameter is not recognized and will be ignored.
Frequent Contributor
Posts: 82

Re: Use Macro for table name

Try using "." after calling macro:

CREATE TABLE &A._MASTER_TO_DUMP AS SELECT DISTINCT (SUM(ACTUAL_DISBURSAL/10000000)) AS
Ask a Question
Discussion stats
  • 3 replies
  • 238 views
  • 0 likes
  • 3 in conversation