Hello again! Here is the Byvarv1 macro I referenced earlier. I run this before I run the %tabledrivenmacro %macro byvarv1(varname ,varnum ,varsort ,sectionnum ,hasmajoryn ,hasminoryn ,parentvar1 ,parentval1 ,parentvar2 ,parentval2 ,parentvar3 ,parentva13 ,parentvar4 ,parentval4); /* has parent var */ %if not(%sysevalf(%superq(parentvar1)=,boolean)) %then %do; /* parent had no discrepancy */ if (&parentvar1.lvl = . | &parentvar1.lvl = 0) %if not(%sysevalf(%superq(parentval1)=,boolean)) %then %do; *Boolean expression searches for true/false. True=if the argument, in this case value of the parent field=1 or has a length greater than 0 (character variables). It will read something as false if the parent field=0 or has a length of 0.; & &parentvar1 = "&parentval1" %end; %if not(%sysevalf(%superq(parentvar2)=,boolean)) %then %do; & (&parentvar2.lvl = . | &parentvar2.lvl = 0) & not(missing(&parentvar2)) %end; %if not(%sysevalf(%superq(parentval2)=,boolean)) %then %do; & &parentvar2 = "&parentval2" %end; %if not(%sysevalf(%superq(parentvar3)=,boolean)) %then %do; /* parent had no discrepancy */ & (&parentvar3.lvl = . | &parentvar3.lvl = 0) & not(missing(&parentvar3)) %end; %if not(%sysevalf(%superq(parentva13)=,boolean)) %then %do; & &parentvar3 = "&parentval3" %end; %if not(%sysevalf(%superq(parentvar4)=,boolean)) %then %do; if (&parentvar4.lvl = . | &parentvar4.lvl = 0) & not(missing(&parentvar4)) %end; %if not(%sysevalf(%superq(parentval4)=,boolean)) %then %do; & &parentvar4 = "&parentval4" %end; then do; %end; if &varname.lvl in (.,0,1,2) then do; /* has major */ %if &hasmajoryn = 1 %then %do; majdenom = 1; alldenom = 1; %end; %else %do; majdenom = 0; %if &hasMinorYN=1 %then %do; alldenom=1; %end; %else %do; alldenom=0; %end; %end; end; else if not(missing(&varname.lvl)) then do; majdenom = 0; alldenom = 0; end; varname = "&varname"; varnum = &varnum; varsort = &varsort; sectionnum = §ionnum; disclevel = &varname.lvl; if not(missing(&varname.rc)) then varraw = &varname.rc; else varraw = &varname; varadjud = &varname.aud; discnote = &varname.nte; output; %if not(%sysevalf(%superq(parentvar1)=,boolean)) %then %do; end; %end; end; %mend;
... View more