SQL works as intended proc sql; create table ds as select * from sdtm.ds where dscat='DISP EVENT' group by usubjid having visitnum=max(visitnum) order by usubjid, visitnum; run; quit; FEDSQL gives ERROR: Column "DS.STUDYID" must be GROUPed or used in an aggregate function It seems as if the FEDSQL requires all the selected variables to be grouped, but then it doesn't take the latest visit. Is there a way to replicate the SQL code with FEDSQL? proc fedsql; create table ds3 as select * from sdtm.ds where dscat='DISP EVENT' group by usubjid having visitnum=max(visitnum) order by usubjid, visitnum; run; quit;
... View more