Hi all , I've attached my code below. I am unable to resolve the MACRO error :All positional parameters must precede keyword parameters Any help is appreciated %macro prior_reg(dataset,cohort,whrcls,linenumber,title);
*where line numebr at index is either 1 ,2 or ge 3;
data &dataset.&linenumber. ;
set &cohort.;
where &whrcls.;
run ;
*the regimen immediately prior to the index regimen will be reported for patients with an line number at index of 1,2 or ge 3;
proc sql;
create table &dataset._reg&linenumber. as
select distinct a.PatientID,a.index_date,a.line_index,b.StartDate,b.LineName,b.LineNumber
from &dataset.&linenumber. as a
left join dfi_panc.Lineoftherapy as b
on a.PatientID =b.PatientID and (b.StartDate lt a.index_date)
order by a.PatientID, b.StartDate ;
quit ;/*244*/
*taking the regimen immediately before the index date ;
data &dataset._last_reg&linenumber.;
set &dataset._reg&linenumber.;
by PatientID StartDate;
if last.PatientID ;
run ;
proc freq data =&dataset._last_reg&linenumber.;
tables LineName /out= &dataset.prior_reg&linenumber.;
run ;
ods csv file ="/data1/projects/IPS/IPS_19/results/''&dataset.'.csv";
proc print data = &dataset.prior_reg&linenumber. ;
title &title.;
run ;
ods csv close ;
%mend prior_reg;
%prior_reg(_03a_folfiri,derived._00a_cohort_folfiri,1,line_index=1,'folfiri-1');
%prior_reg(_03a_folfiri,derived._00a_cohort_folfiri,2,line_index=2,'folfiri-2');
%prior_reg(_03a_folfiri,derived._00a_cohort_folfiri,3,line_index ge 3,'folfiri-3');
%prior_reg(_03a_folfiri,derived._00a_cohort_folfiri,4,PatientID ne ' ' ,'folfiri-4');
%prior_reg(_03b_folfox,derived._00b_cohort_folfox,1,line_index=1,'folfox-1');
%prior_reg(_03b_folfox,derived._00b_cohort_folfox,2,line_index=2,'folfox-2');
%prior_reg(_03b_folfox,derived._00b_cohort_folfox,3,line_index ge 3,'folfox-3');
%prior_reg(_03b_folfox,derived._00b_cohort_folfox,4,PatientID ne ' ','folfox-4');
... View more