Hi
I would like to create a string variable that copies all characters from another string variable up to specific characters:
Here is a sample of the data:
I am trying to generate another string variables up to the characters " CONS ". For the given data sample, that would be:
I have tried using a combination of the following, but I could not reach my goal:
gen newvar = substr(MarketName, strpos(MarketName, ":") + 1, .) Please help. Thanks!
I would like to create a string variable that copies all characters from another string variable up to specific characters:
Here is a sample of the data:
Code:
MarketName 1414 Degrees Limited CONS 285@31 19M13:733751~1072 1414 Degrees Limited CONS [email protected] 19M13:733745~875 8IP Emerging Companies Limited CONS 125@71 19M13:733746~2001 8IP Emerging Companies Limited CONS 126@72 19M13:733746~1995 8common Limited CONS [email protected] 19M13:733745~532 8common Limited CONS [email protected] 19M13:733745~531 9 Spokes International Limited CONS [email protected] 19M13:774955~1983 9 Spokes International Limited CONS [email protected] Z8750-BL150442 9 Spokes International Limited Rights Issue - Taken Up CONS [email protected] Z8750-BL147287 9 Spokes International Limited Rights Issue - Taken Up CONS [email protected] Z8750-BL150434
Code:
MarketName 1414 Degrees Limited 1414 Degrees Limited 8IP Emerging Companies Limited 8IP Emerging Companies Limited 8common Limited 8common Limited 9 Spokes International Limited 9 Spokes International Limited 9 Spokes International Limited Rights Issue - Taken Up 9 Spokes International Limited Rights Issue - Taken Up
gen newvar = substr(MarketName, strpos(MarketName, ":") + 1, .) Please help. Thanks!
Comment