PR: Your answer assumes there will ALWAYS be a .
If there is not a . the result will be blank and yield a warning ;-(
codes result result2
12.32 12 12
123.356 123 123
d12.36 d12 d12
e12.36 e12 e12
e12.00 e12 e12
er12.3 er12 er12
ra21.365 ra21 ra21
>Warning # 651
>The third argument to the CHAR.SUBSTR function is invalid.
>Command line: 786 Current case: 8 Current splitfile group: 1
1234567 1234567 1.20000 1 1
Number of cases read: 9 Number of cases listed: 9
PRogman wrote
Please read about string functions (HELP| Command Syntax Reference | Universals | Transforming Expressions | String functions).
/PR
DATA LIST FREE / codes(a8).
BEGIN DATA
'12.32'
'123.356'
'd12.36'
'e12.36'
'e12.00'
'er12.3'
'ra21.365'
END DATA.
STRING result (A8) .
COMPUTE result=char.substr(codes, 1, CHAR.INDEX(codes,'.')-1) .
EXECUTE.
LIST codes result .
codes result
12.32 12
123.356 123
d12.36 d12
e12.36 e12
e12.00 e12
er12.3 er12
ra21.365 ra21
Number of cases read: 7 Number of cases listed: 7
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"