Reputation: 16004
I am new to SAS formats.
Say I have a string in the form of NNN.xxx where NNN is a number in the format of z3. and xxx is just some text.
E.g.
001.NUL and 002.ABC
Now can I define a format, fff, such that b = put("&NNN..&xxx.",fff.); returns only the &xxx. part?
I know we can achieve this by using b = substr("&NNN..&xxx.",5,3); but I want to have a format so that I can simply assign the format to a variable and not have to create a new variable out of it.
Thanks in advance.
Upvotes: 1
Views: 977
Reputation: 61
As said, I think this can be achieved thru combination of custom defined formats along with SAS builtin character functions - i.e. CAT, CATX, CATS, CATT etc...
Upvotes: 0
Reputation: 2307
Probably the only way is to code your own custom character format using SAS/TOOLKIT. It will be much easier to create another variable as you do with substr().
Upvotes: 1