Command Reference : String and Date Function Reference
Left portion of string.
Syntax: @left(str, n)
str: string
n: integer
Return: string
Returns a string containing n characters from the left end of str. If the string is shorter than n characters, this function returns all of the characters in the source string.
The commands
string orig = "I did not do it"
string sc1 = @left("I did not do it", 5)
string sc2 = @left(orig, 5)
return the string objects SC1 and SC2 containing the string “I did”.
If ALPHA1 is an alpha series,
alpha a1 = @left(alpha1, 7)
returns the left-most 7 characters from the string values of ALPHA1 for each observation in the workfile sample.
If SVEC1 is an string vector,
svector s1 = @left(svec1, 12)
returns an svector containing 12 characters from the left end of each element of SVEC1.
See also @wleft, @right, and @mid.