Python Forum

Full Version: Hi Guys, please help me to write SAS macro parameter equivalent code in Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
please help me to automate below sas macro parameter in python.

Thank you,

%macro test_macro(date, metnam, measuresuf, measurebase, bas_flag, month, year);
proc sql;
%local_connect_to_teradtaa(database = dbc);
create table work.tmp_mta_prodmon_ubs as
select * from connection to tera
(select 
&metnam as metric_name,
extract(year from load_date)*100+ extract(month from load_date) as data_dt,
0 as mth_nbr,
sum(&measuresuf) as metric_value,
sum(&measurebase) as metric_base,
case when brand = '' then 'unknown' else brand end as brand,
&bas_flag. as bas_calc_flag,
'ABC' as legal_entity
from bac.test_table
where extract(month from load_date) = &month
and extract(year from load_date) = &year
group by metric_name,data_dt,mth_nbr,brand,bas_calc_flag,legal_entity
);
quit;
%mend;

%test_macro(&dt,'metric_a', test_stock,test_inact,1,&mth,&yr);
Please use proper coding tags while posting a thread - see BBCode to know more - it makes your code easier for us to understand
We will be glad to help, but won't write it for you (unless posted in jobs section, which must include salary, wage, or sum amount within the post).
So please show what you have tried so far, and specific item you need help with.
Thank You