Using variable sampling rate in a macro

Analytics
N/A

Using variable sampling rate in a macro

Does anybody know why Teradata does not let me create the following simple macro:

CREATE MACRO DB.mc_TEST (sample_rt FLOAT) AS
(SELECT C1, C2, C3 FROM DB.Some_view A
SAMPLE :sample_rt ;-) ;

It throws the following syntax error:

3707: Syntax error, expected something like an integer or a decimal number or a floating point number or a 'WHEN' keyword between the 'SAMPLE' keyword and ':'.

Is it really possible that Teradata does not allow one to do this? Any ideas on how to do smapling while providing flexibility to change sampling rate would be appreciated.
1 REPLY
Enthusiast

Re: Using variable sampling rate in a macro

I don't think it will allow this; just like you can't use a host variable for a column name or table name.

You may want to use a stored procedure instead and load the rows into a table that you then use a macro to retrieve from.