Looking at the naming patterns of your variables, I would suggest macro language rather than arrays. (You can add arrays as well, but it's harder and takes more SAS skills to both write and read the program.) For example, the macro could look like this:
%macro if_then;
%local k;
%do k=4 %to 33;
IF DaySmoke_Quest&k = 0 THEN DO;
Cigarett_Amount&k = 0;
NicGum_Amount&k = 0;
NicLoz_Amount&k = 0;
LitCigars_Amount&k = 0;
Cigarillos_Amount&k = 0;
NicPatch_Amount&k = 0;
Hookahs_Amount&k = 0;
Snuff_Amount&k = 0;
Bidis_Amount&k = 0;
Pipes_Amount&k = 0;
Blunts_Amount&k = 0;
FullCigars_Amount&k = 0;
ECig_Amount&k = 0;
HandCigs_Amount&k = 0;
END;
%end;
%mend if_then;
With the macro written, you can add within a DATA step:
%if_then
That will generate the 420 assignment statements.
... View more