IBM Support

Extract substrings from long string based on connecting character

Question & Answer


Question

I have a string variable named EmployeeID in an SPSS Statistics data file. This variable has several blocks of information that are separated by hyphens. I wish to extract each of these blocks of information between the hyphens and store them in new string variables. The length of a given block may vary across cases but there will always be 5 blocks that are separated by 4 hyphens. The new variable names and the string length required for each are as follows: Division 4 Region 4 Location 4 Team 8 Employee A Can you provide a set of commands that would extract the blocks of information to new string variables?.

[{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"--","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Not Applicable","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
16 June 2018

UID

swg21653807