multi touch channels

Accepted Solution Solved
Reply
Trusted Advisor
Posts: 1,204
Accepted Solution

multi touch channels

Hi Everyone,

I've dataset that contains channel variable given below.

Channel

Social Media>Natural

Social Media

Social Media

Social Media

Referrers>Paid>Referrers>Natural 

Referrers>Paid>Referrers

Referrers>Paid>Natural 

Referrers>Paid>Email No Referrer>Email>Paid 

Referrers>Paid 

Referrers>Paid 

Referrers>Paid 

Referrers>Natural>Referrers>Natural 

Referrers>Natural>Referrers>Natural 

Referrers>Natural>Paid>Paid>No Referrer>Paid 

Referrers>Natural>Paid>Paid>No Referrer>Paid 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Natural 

Referrers>Email>No Referrer>Referrers>Paid>Natural 

Referrers>Email>No Referrer>Referrers>Natural>Referrers

Referrers>Email>No Referrer>Referrers

Referrers>Email>No Referrer>Referrers

Just looking for solution that can generate customer behaviour to see how many different channels were touched by a customer by creating 6 variables and putting channel names under columns if channel is appearing in the stacking. For example row one I'll have

Var1                    Var2          Var3     Var4               Var5               Var6

Social Media      Natural     

Thanks in advance for your help.


Accepted Solutions
Solution
‎05-03-2014 01:10 AM
Super User
Posts: 9,681

Re: multi touch channels

data have;

infile cards truncover;

input Channel  $200.;

cards;

Social Media>Natural

Social Media

Social Media

Social Media

Referrers>Paid>Referrers>Natural

Referrers>Paid>Referrers

Referrers>Paid>Natural

Referrers>Paid>Email No Referrer>Email>Paid

Referrers>Paid

Referrers>Paid

Referrers>Paid

Referrers>Natural>Referrers>Natural

Referrers>Natural>Referrers>Natural

Referrers>Natural>Paid>Paid>No Referrer>Paid

Referrers>Natural>Paid>Paid>No Referrer>Paid

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Email>No Referrer>Referrers>Paid>Natural

Referrers>Email>No Referrer>Referrers>Natural>Referrers

Referrers>Email>No Referrer>Referrers

Referrers>Email>No Referrer>Referrers

;

run;

data want;

set have;

array v{*} $40 var1-var6;

do i=1 to countw(channel,'>');

  v{i}=scan(channel,i,'>');

end;

drop i;

run;

Xia Keshan

View solution in original post


All Replies
Solution
‎05-03-2014 01:10 AM
Super User
Posts: 9,681

Re: multi touch channels

data have;

infile cards truncover;

input Channel  $200.;

cards;

Social Media>Natural

Social Media

Social Media

Social Media

Referrers>Paid>Referrers>Natural

Referrers>Paid>Referrers

Referrers>Paid>Natural

Referrers>Paid>Email No Referrer>Email>Paid

Referrers>Paid

Referrers>Paid

Referrers>Paid

Referrers>Natural>Referrers>Natural

Referrers>Natural>Referrers>Natural

Referrers>Natural>Paid>Paid>No Referrer>Paid

Referrers>Natural>Paid>Paid>No Referrer>Paid

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Natural

Referrers>Email>No Referrer>Referrers>Paid>Natural

Referrers>Email>No Referrer>Referrers>Natural>Referrers

Referrers>Email>No Referrer>Referrers

Referrers>Email>No Referrer>Referrers

;

run;

data want;

set have;

array v{*} $40 var1-var6;

do i=1 to countw(channel,'>');

  v{i}=scan(channel,i,'>');

end;

drop i;

run;

Xia Keshan

Trusted Advisor
Posts: 1,204

Re: multi touch channels

Thanks Keshan - This is what I was looking for. One quick question, If there is no delimeter between words how I can modify syntax please?

Naeem

Super User
Posts: 17,829

Re: multi touch channels

How do you know when a word ends then?The third parameter to the scan and second parameter to the countw function represent the delimiters.

Super Contributor
Posts: 644

Re: multi touch channels

If there are no delimiters but the responses are unique you could stack a bunch of IF statements using the FIND() function

If FIND(channel, 'Social Media') then Var1 =  'Social Media' ;

If FIND(channel, 'Natural') then Var2 =  'Natural' ;

If FIND(channel, 'Referrers') then Var3 =  'Referrers' ;

If FIND(channel, 'Paid') then Var4 =  'Paid' ;

If FIND(channel, 'Email No Referrer') then Var5 =  'Email No Referrer' ;

else

If FIND(channel, 'No Referrer') then Var6 =  'No Referrer' ;

[untested]

Should also work with delimited data - delimiters will be ignored. 

Might fail though if both 'Email No Referrer' and 'No Referrer' can be in the same response.

In that case you would have to search through each contact string, use the returned value of FIND(channel, 'No Referrer') - the position at which it is found. If the value is 1 then that is a hit. Otherwise check whether the preceding 6 characters were 'Email '.  If so, iterate through Contact using a starting position higher than the last position until either the preceding characters are not 'Email ' (a hit) or FIND() returns 0 (not found).

Richard

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 260 views
  • 6 likes
  • 4 in conversation