Python Forum
Hi Guys, please help me to write SAS macro parameter equivalent code in Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hi Guys, please help me to write SAS macro parameter equivalent code in Python
#1
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);
Reply
#2
Please use proper coding tags while posting a thread - see BBCode to know more - it makes your code easier for us to understand
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply
#3
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  guys please help me , pycharm is not able to identify my xlsx file CrazyGreenYT7 1 500 Jun-13-2021, 02:22 PM
Last Post: Larz60+
  Python C++ Template Equivalent deanhystad 7 923 May-04-2021, 07:45 PM
Last Post: deanhystad
  Auto-populate Macro variables Spartan314 3 1,101 Mar-08-2021, 12:36 AM
Last Post: Spartan314
  How do I reduce the time to Invoke Macro via Python? JaneTan 1 725 Dec-28-2020, 06:46 AM
Last Post: buran
  How to write a code with İF function? Aycaaxx 1 592 Nov-03-2020, 05:46 AM
Last Post: deanhystad
  hi guys, i'm back to learning python ! astral_travel 6 1,134 Oct-05-2020, 10:02 AM
Last Post: astral_travel
  I need my compiled Python Mac app to accept a file as a parameter Oethen 2 1,124 May-10-2020, 05:57 PM
Last Post: Oethen
  python equivalent to MATLAB xcov chai0404 2 1,768 Apr-02-2020, 10:29 PM
Last Post: chai0404
  Python equivalent of Matlab code kwokmaster 1 1,619 Mar-25-2020, 10:14 PM
Last Post: j.crater
  Equivalent of 'bwareafilt' for Python Mighty 1 1,653 Feb-05-2020, 10:32 PM
Last Post: Marbelous

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020