Transcription of Syntax Description - Stata
1 ( ) Extract substringSyntaxDescriptionConformability DiagnosticsAlso seeSyntaxstring matrixsubstr(string matrix s,real matrix b,real matrix l)string matrixsubstr(string matrix s,real matrix b)Descriptionsubstr(s,b,l)returns the substring ofsstarting at positionband continuing for a length ofl, the starting position; the first character of the string isb= >0 is interpreted as distance from the start of the string;b=2 means starting at thesecond <0 is interpreted as distance from the end of string;b= 1 means starting at the lastcharacter;b= 2 means starting at the second from the last the length;l=2 means for two <0 is treated the same asl=0: no characters are.
2 Is interpreted to mean to the end of the (s,b)is equivalent tosubstr(s,b, .)for strings that do not contain binary 0. If thereis a binary 0 to the right ofb, the substring frombup to but not including the binary 0 is arguments are not scalar,substr()returns element-by-element (s,b,l):s:r1 c1b:r2 c2l:r3 c3;s,b, andlr-conformableresult:max(r1,r2,r3) max(c1,c2,c3)substr(s,b):s:r1 c1b:r2 c2;sandbr-conformableresult:max(r1,r2) max(c1,c2)12 substr( ) Extract substringDiagnosticsInsubstr(s,b,l)andsu bstr(s,b), ifbdescribes a position before the beginning of the stringor after the end,""is returned. Ifb+ldescribes a position to the right of the end of the string,results are as if a smaller value forlwere see[M-4]string String manipulation functions