Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro Question

Status
Not open for further replies.

Queryman

Programmer
Nov 4, 2002
243
US
I have a table that has a Character field that I am trying to insert a macro into:
The macros are

%let blending1 = INDIES15;
%let blending2 = SUPERCHAINS15;
%let blending3 = INDIES13;
%let blending4 = STORES14;

The table is
execute (create table ACCESS_DENSITY_ADV_NETWORK (ATTRIBUTE_ROW char(60), AVAILABLE_PHARMACIES integer,
NETWORK_PHARMACIES integer, BLENDING1 integer, BLENDING2 integer, BLENDING3 integer,BLENDING4 integer)) by odbc;


execute (insert into ACCESS_DENSITY_ADV_NETWORK
select "21: BLENDING1 &BLENDING1", 0, 0, 0 ,0 ,0 ,0) by odbc;
execute (insert into ACCESS_DENSITY_ADV_NETWORK
select "22: BLENDING2 &BLENDING2", 0, 0, 0 ,0 ,0 ,0) by odbc;
execute (insert into ACCESS_DENSITY_ADV_NETWORK
select "23: BLENDING3 &BLENDING3", 0, 0, 0 ,0 ,0 ,0) by odbc;
execute (insert into ACCESS_DENSITY_ADV_NETWORK
select "24: BLENDING4 &BLENDING4", 0, 0, 0 ,0 ,0 ,0) by odbc;

the macro will not resolve unless I put them in double quotes when I insert into the table, but if I do, it will not insert and gives me the following error
ERROR: CLI execute error: [NCR][Teradata RDBMS] Cannot resolve column '22: BLENDING2 SUPERCHAINS15'. Specify table or view.

Any suggestions will be appreciated



Michael

 
Try this:

%let blending1 = 'INDIES15';
execute (insert into ACCESS_DENSITY_ADV_NETWORK
select '21: BLENDING1 ' || &BLENDING1, 0, 0, 0 ,0 ,0 ,0) by odbc;

or
%let blending1 = '21: BLENDING1 INDIES15';
execute (insert into ACCESS_DENSITY_ADV_NETWORK
select &BLENDING1, 0, 0, 0 ,0 ,0 ,0) by odbc;

SAS would not resolve your macro in single quotes, and your database only take single quotes for string field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top