I believe you are effectively trying to do this:
if pa_15 = . or pa_45 = . then do;
pa_15 = .;
pa_45 = .;
end;
followed by the same for pb_15,pb_45 through pm_15,pm_45. Two suggestions :
First, don't make a do group. Instead use code like this:
if n(pa_15,pa_45)=1 then call missing(pa_15,pa_45);
followed by pb through pm.
Second, to use arrays, use this structure:
array p15 {13} pa_15 pb_15 pc_15 pd_15 pe_15 pf_15 pg_15
ph_15 pi_15 pj_15 pk_15 pl_15 pm_15;
array p45 {13} pa_45 pb_45 pc_45 pd_45 pe_45 pf_45 pg_45
ph_45 pi_45 pj_45 pk_45 pl_45 pm_45;
do i=1 to 13;
if n(p15{i},p45{i})=1 then call missing(p15{i},p45{i});
end;
To do it the way you originally conceived, you would have to use sas macro coding, which does not seem to be well-justified, given the relatively simple technique I'm suggesting.
Edit note: the do loop above was corrected (6/19/2024, 14:00 UT).
... View more