How can i split a string variable into multiple variable, In the attach document, I want to split variable "hh_pri_industry_occupation" into two variable containment three digits in each. First three digits will make one variable and rest in another variable.
It seems that the dataset did not make it through as an attachment, so I am going to have to make some assumptions about the data. I am going to assume that
hh_pri_industry_occupation field is an integer with exactly 6 digits and that the resulting two variables will also be integers.
This can be done in several different ways, but I think that the easiest way is to convert the original field in to a string and then utilize some of the string operations to extract what you need.
The first three digits can then be extracted using a "Derive" node with the Formula:
to_integer( startstring( 3 , to_string( hh_pri_industry_occupation ) ) )
This converts the field to a string, extracts the first 3 characters using the
startstring function, and then converts those to an integer.
The last three digits can be derived in a similar manner by the formula:
to_integer( endstring( 3 , to_string( hh_pri_industry_occupation ) ) )
This is the same as above, but uses the
endstring function to extract the last three characters.
Support Chinese in Text analytics 18 2 Answers