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


Messages In This Thread
Hi Guys, please help me to write SAS macro parameter equivalent code in Python - by Manohar9589 - Jun-13-2020, 09:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Equivalent Python code from VBA Mishal0488 2 784 Apr-19-2024, 10:32 AM
Last Post: masonsbore
  write code that resides in parent directory franklin97355 3 407 Apr-14-2024, 02:03 AM
Last Post: franklin97355
  needing some help to write some code for a game calculator rymdaksel 1 416 Jan-02-2024, 09:56 AM
Last Post: deanhystad
  How do I handle escape character in parameter arguments in Python? JKR 6 1,175 Sep-12-2023, 03:00 AM
Last Post: Apoed2023
  [ERROR] ParamValidationError: Parameter validation failed: Invalid type for parameter gdbengo 3 11,090 Dec-26-2022, 08:48 AM
Last Post: ibreeden
  python call stored procedure with two parameter mg24 4 1,532 Sep-27-2022, 05:02 AM
Last Post: deanhystad
  PySpark Equivalent Code cpatte7372 0 1,266 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,662 Jan-01-2022, 08:13 PM
Last Post: Yoriz
  guys please help me , pycharm is not able to identify my xlsx file CrazyGreenYT7 1 2,023 Jun-13-2021, 02:22 PM
Last Post: Larz60+
  Python C++ Template Equivalent deanhystad 7 3,411 May-04-2021, 07:45 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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