I want to extract character strings from a variable (Dx1), but the length and position of the strings varies, but they are separated by dashes. Sometimes there are multiple dashes. For example...
"7812-abcdef -9"
"v7892-xyz -0"
"812-fghkj -0"
"17361-gf-jhyt -9"
What I would like to do is create a new variable that extracts the digits/characters before the first dash, and then another variable that extracts the characters between the first and second dashes. So,
Var1 Var2
7812 abcdef
v7892 xyz
812 fghkj
17361 gf-jhyt
I tried following the example posted here, but it just extracted the dash. Changing the +1 to another number extacts that number of characters, but my data length varies.
https://community.jmp.com/t5/Uncharted/JSL-Character-String-Functions/ba-p/21323
Here's what I wrote. What am I doing wrong?
Trim(
Substr(
:Name( "Dx1" ),
Contains( :Name( "Dx1" ), "-" ),
1
)
)