Desktop productivity for business analysts and programmers

request for help

Reply
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 papers,web,radio,tv 1- read, 0-don't read
for age 1: 18-24 , 2: 25-34.........
for gender 1 male, 2 female

i would like to see my out put
1.

anytwonewspapers radio tv web
15 5 6 8


output 2.
web radio tv newspapers1
15 8 9 25


output3:

news papers1xpaper2/paper3/paper4 radio tv web
10 3 8



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

Many thanks in-advance
ps
Respected Advisor
Posts: 4,130

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 paperSmiley Happy=2);
radio= (sum(of radioSmiley Happy>1);
tv= (sum(of tvSmiley Happy>1);
web= (sum(of webSmiley Happy>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
Ask a Question
Discussion stats
  • 1 reply
  • 90 views
  • 0 likes
  • 2 in conversation