Help using Base SAS procedures

Filtering URL addresses

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 124
Accepted Solution

Filtering URL addresses

[ Edited ]

Accepted Solutions
Solution
‎04-10-2016 09:00 AM
Super User
Posts: 9,671

Re: Filtering URL addresses



data x;
input x $80.;
y=scan(x,1,'/')||'/'||scan(x,2,'.','kad');
if findc(scan(x,-1,'/'),'.') then call missing(y);
cards;
www.abc.com/about
www.abc.com/about-afib
www.abc.com/about/activations
www.abc.com/home/
www.abc.com/mobile
www.mobileabc.com/xyz.php
;
run;

View solution in original post


All Replies
Super User
Super User
Posts: 7,395

Re: Help with data

Not sure what the "question" is here or what the logic is.  There a many ways to do that: if _n_ in (1,4,5) then output;, or if scan(<text),2,"/") in ("about","home","mobile") then output; etc.

 

 

Solution
‎04-10-2016 09:00 AM
Super User
Posts: 9,671

Re: Filtering URL addresses



data x;
input x $80.;
y=scan(x,1,'/')||'/'||scan(x,2,'.','kad');
if findc(scan(x,-1,'/'),'.') then call missing(y);
cards;
www.abc.com/about
www.abc.com/about-afib
www.abc.com/about/activations
www.abc.com/home/
www.abc.com/mobile
www.mobileabc.com/xyz.php
;
run;

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 299 views
  • 3 likes
  • 3 in conversation