Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Importing data into Stata


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Importing data into Stata
Date   Fri, 16 Dec 2005 12:26:34 -0000

As Stata is telling you, -substr()- is not 
a command. 

It is a function. Functions cannot be invoked
in this way. The manual section you cite
does not show a command prompt. 

You can use -substr()- to remove parentheses, but 
as I advised earlier, -destring- is probably 
easier for you. 

destring v1, ignore("()") replace 

Nick 
[email protected] 

b. water
 
> Stata 8.2 Window XP Pro SP2.
> 
> Thanks to Richard Goldstein & Nick Cox for their advice. 
> Split and parse 
> with destring works well and overcome my defective substr 
> (see below). Here 
> are my substr tries (v1 is my data authors (year) variable following 
> insheet) and the accompanying error messages:
> 
> . 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).

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index