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
  needing some help to write some code for a game calculator rymdaksel 1 355 Jan-02-2024, 09:56 AM
Last Post: deanhystad
  How do I handle escape character in parameter arguments in Python? JKR 6 1,038 Sep-12-2023, 03:00 AM
Last Post: Apoed2023
  Equivalent Python code from VBA Mishal0488 1 632 Jul-05-2023, 10:43 AM
Last Post: carecavoador
  [ERROR] ParamValidationError: Parameter validation failed: Invalid type for parameter gdbengo 3 10,643 Dec-26-2022, 08:48 AM
Last Post: ibreeden
  python call stored procedure with two parameter mg24 4 1,403 Sep-27-2022, 05:02 AM
Last Post: deanhystad
  PySpark Equivalent Code cpatte7372 0 1,227 Jan-14-2022, 08:59 PM
Last Post: cpatte7372
Question convert autohotkey script to python / macro - press key when pixel get colour willson94d 1 3,572 Jan-01-2022, 08:13 PM
Last Post: Yoriz
  guys please help me , pycharm is not able to identify my xlsx file CrazyGreenYT7 1 1,971 Jun-13-2021, 02:22 PM
Last Post: Larz60+
  Python C++ Template Equivalent deanhystad 7 3,313 May-04-2021, 07:45 PM
Last Post: deanhystad
  Auto-populate Macro variables Spartan314 3 2,609 Mar-08-2021, 12:36 AM
Last Post: Spartan314

Forum Jump:

User Panel Messages

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