I have a large dataset with the variable 'species' that consists of the scientific name in the form of the two word 'Genus species' and would like to assign some of these animals into a more general 'name' variable by using only the genus portion of the scientific name. I have tried to use the INDEX function but cannot figure out how to search for multiple excerpts--an example:
if index(species,'Genus1'||'Genus2') then name = 'new name';
else name = species;
this code does not generate an error but also does resolves to the 'else' statement.
INDEXC does not appear to be an option because it does not retain the character pattern.
Does anyone have any suggestions?
Thanks