Python Forum
Hi Guys, please help me to write SAS macro parameter equivalent code in Python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Hi Guys, please help me to write SAS macro parameter equivalent code in Python (/thread-27620.html)



Hi Guys, please help me to write SAS macro parameter equivalent code in Python - Manohar9589 - Jun-13-2020

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);



RE: Hi Guys, please help me to write SAS macro parameter equivalent code in Python - pyzyx3qwerty - Jun-14-2020

Please use proper coding tags while posting a thread - see BBCode to know more - it makes your code easier for us to understand


RE: Hi Guys, please help me to write SAS macro parameter equivalent code in Python - Larz60+ - Jun-14-2020

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