Hello, i have a data set which has all the individual observations. I'm trying to get a table/view which will give me the group data/summation of observations/not sure what to call it, which would look like the example of group data shown below. i.e. i have the data set which has each individual person who has responded to what look slike a survey denoting the following cahracteristics.
You could do this kind of report (with nested counts) using either PROC REPORT or PROC TABULATE. It really depends on how you want the final look and feel of the report. You do not need to build arrays or views. PROC TABULATE is the greatest slicer and dicer of data invented and PROC REPORT runs a close second in the cross-tab department.
The only thing is that It will be hard to "label" the headers on the left, as you show (for Rel Att and Birth Control), but user-defined formats will make the meaning of each 1 and 2 clear. And PROC TABULATE comes closest to allowing you to label on the left, since you can put text strings into the TABULATE box area.
I used SASHELP.PRDSALE to fake up some data -- and picked some values for the user-defined formats. If you compare the results of the programs below, you can then decide whether to spend your efforts learning PROC REPORT or PROC TABULATE.
if country = 'GERMANY' and region = 'EAST' then POLVIEW = 1;
else if country = 'GERMANY' and region = 'WEST' then POLVIEW = 2;
else if country = 'CANADA' and prodtype = 'FURNITURE' then POLVIEW = 2;
else if country = 'CANADA' and prodtype = 'OFFICE' then POLVIEW = 1;
else POLVIEW = 3;
if region = 'EAST' then premarital_sex = 1;
else premarital_sex = 2;
if division = 'CONSUMER' then rel_att = 1;
else rel_att = 2;
if product in ('BED', 'DESK') then birth_cont = 1;
else birth_cont = 2;