Contributor
Posts: 43

# request for help

Hi could any one suggest the solution
i have data set with the following media variables
newspaer1 paper2 paper3 paper4 web1 web2 web3 radio1 radio2 tv1 tv2 age gender
1 0 1 0 1 0 0 1 1 0 1 2 1
1 1 0 0 0 1 0 0 1 1 1 3 2
1 1 1 0 1 1 1 0 0 0 1 4 1
0 1 0 1 1 1 0 0 1 0 1 1 2
0 0 1 1 0 1 0 1 0 0 1 2 2

i would like to find out cross overs between variables - let us say
how many people read any two news papers and watch web/tv/radio vise versa
then
age vs. gender wise cross sections

for age 1: 18-24 , 2: 25-34.........
for gender 1 male, 2 female

i would like to see my out put
1.

15 5 6 8

output 2.
15 8 9 25

output3:

10 3 8

i tried through summary tables but i couldn't able to figure out.

ps
Posts: 4,779

## Re: request for help

No idea how you get the sums in your examples with the data you give us.

The following code might give you some hints of how to tackle this challenge:

data have;
infile datalines dlm=' ' dsd truncover;
input
paper1 paper2 paper3 paper4 web1 web2 web3 radio1 radio2 tv1 tv2 age gender;
anytwopapers= (sum(of paper=2);
tv= (sum(of tv>1);
web= (sum(of web>1);
datalines;
1 0 1 0 1 0 0 1 1 0 1 2 1
1 1 0 0 0 1 0 0 1 1 1 3 2
1 1 1 0 1 1 1 0 0 0 1 4 1
0 1 0 1 1 1 0 0 1 0 1 1 2
0 0 1 1 0 1 0 1 0 0 1 2 2
run;

proc format;
value gender
1='Male'
2='Female'
other='?'
;
quit;

proc tabulate data=have format=8. noseps;
where anytwopapers=1 and (radio=1 or tv=1 or web=1);
class age gender anytwopapers radio tv web;
format gender gender.;
keylabel n=' ' ;
table age all='Total', (gender all='Total')*(anytwopapers radio tv web )
/rts=10;
run; Message was edited by: Patrick
Discussion stats