On 12/16/05, b. water <[email protected]> wrote:
> Stata 8.2 Window XP Pro SP2.
>
> . substr(v1,-6,.)
> unrecognized command: substr
> r(199);
>
> . substr("v1",-6,.)
> unrecognized command: substr
> r(199);
>
> . substr("abcdef",2,3)
> unrecognized command: substr
> r(199);
>
> Any explanation for the error messages? The last example was taken straight
> from the manual [R] functions substr(s,n1,n2).
>
You need to generate a new variable, or place something into a macro.
Try...
. gen new_var = substr(v1, -6, .)
. list v1 new_var
or
. local test = substr("abcdef", 2, 3)
. di "`test'"
HTH's
Neil
--
"The surest way to make a monkey of a man is to quote him."
- Robert Benchley
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/