Respected users, I want to split one string variable into two variables. The string variable (master variable) contain 6 digits maximum. Now I want one variable of first 3 digits from master variable and another variable containing last 3 digits without effecting the other variables. Please suggest me any path.
Thanks and regards, Biswajit
This is something that can be handled in the GUI under the "Transform -> Compute" menus. In the Compute dialog you will want to create two new variables of the appropriate type and then assign a portion of your original variable to each of these. Assuming you have a string field to start with, you might use the CHAR.SUBSTR(strvar,start,length) function to parse it. You could also do this in SPSS Statistics Command Syntax.
Assuming your original variable "master" is a 6 character string field, here is an example creating two 3 character string fields "left" and "right" with the leftmost and rightmost 3 characters from "master" respectively:
DATA LIST FREE /master (A6). BEGIN DATA abcdef ghijkl mnopqr stuvwx END DATA. LIST. STRING left right (A3). COMPUTE left = CHAR.SUBSTR(master,1,3). COMPUTE right = CHAR.SUBSTR(master,4). LIST.