For loop in python for a SAS Macro SQL

Viewed 31

I am trying to convert a SAS macro SQL to equivalent python code.My SAS macro SQL is

proc sql;
select count(distinct fx) into :fx_count from processing_wgt;
select min(fx) into :fx_start from processing_wgt;
quit;

%do i=1 %to &fx_count.;

data _fx_processing_wgt;
set processing_wgt;
where fx=&fx_start.+&i.-1;
run;
data _fx_weights;
set gm_weights;
where fx=&fx_start.+&i.-1;
run;

My python code is given below:

fx_count = processing_wgt.fx.nunique()
print(fx_count)

fx_start=processing_wgt['fx'].min()
print(fw_start)

But I am unable to write the for loop for the condition mentioned above.I am new in python,I will be needing help how to do this.

0 Answers
Related