PROCs FORMAT and Tabulate First, instead of creating lots of if/then/else code use a format to create groups and text labels. with your labels one can't tell which end to include in the ranges below. You need to decide that before proceding. Proc Format library=work; value age 45 - 49 = '45 to 49' 50 - 54 = '50 to 54' 55 - 59 = '55 to 59' 60 - 64 = '60 to 64' 65 - 70 = '65 to 70' ; /* assumes you have variable coded 1 is yes 0 is no , if the other way around change the text*/ value yn 1 = 'Yes' 0 = 'No' ; run; /* this should make a table similar to what you show. IF ANY OF THE V1 V2 OR V3 ARE MISSING you may want the option /missing in class statement. */ proc tabulate data=<your data set name here> ; class age; class v1 v3 ; /* I didn't put V2 in here cause I don't know what your coding looks like */ format age age. v1 v3 yn. ; table age', v3' *n=''*f=f6.0; run; Making actual 2x2 tables within the cells of age and V3 might be more work than it's worth. but you can get similar information with proc tabulate data=<your data set name here> ; class age; class v1 v2 v3 ; /* I didn't put V2 in here cause I don't know what your coding looks like */ format age age. v1 v3 yn. ; table age' * V2, v3' * V1 * n=''*f=f6.0; run; LABELS for v1 v2 and v3 will make the table more useful. Something like: label V1 = 'Response to question 1';
... View more