Where do you set the value for &study? Your comparison is case sensitive so if you set &study with something like : %let study=Trial C;
it would not match the value Trial c
Source and value for &srcdata?
If &srcdata is not a library then your data reference is incorrect. If it already contains a library.dataset then you do not want the second .
%let srcdata=work.data;
%let setname = &srcdata..famh;
/*invalid data set name*/
%put setname is &setname.;
%let srcdata=dataset;
%let setname = &srcdata..famh;
/*treats what might be data set name as library*/
%put setname is &setname.;
In general it is not best practice to use values in macro code not explicitly passed as parameters. Your code call does not document the expected values sent to the macro with something like %fa
You would be better off using %macro fa (study= , srcdata= ); in the definition and then call as
%fa(study=x, srcdata=lib); or what ever values are being used.