2

I am working with a variable which is basically URLs. So observations include values like for example

  • www.google.com
  • https://www.google.com
  • https://yahoo.movies.com

I am trying to create a do file to import a bunch of these files into Stata and need a reliable method to remove the www. and the https:// parts from these variables over a wide range of URLs.

In Excel I can do this simply by finding https:// or www. and replacing it with nothing, how do I achieve the same in Stata?

I am working in Stata 13.1 SE on Windows 8 Pro 64 bit.

1 Answer 1

5

You can use subinstr() function.

Example:

subinstr("this is this","is","X",.) = "thX X thX"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.