| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: trim spaces in postcode
Thanks Nick
Nick Cox wrote:
I have two guesses here.
First, -generate- can be smart because
Stata can look at the expression on the RHS of
gen newvar = exp
and work out what kind of beast it is. What is more,
Stata is always going to be correct on this, or else
you are asking for something illegal.
Second, -input- and -infile- historically weren't designed
to be smart because it was thought that the user
could and should specify what variable types were wanted.
-insheet- came a fair while later and was more ambitious.
It peeks at the first and second lines of the file and
tries to work out what is going on. Often, it can misunderstand,
which is part of the rationale for -destring- and -tostring-,
which came a wave later yet.
In short, -infile- and -input- remain as originally designed
on the principle of not fixing what isn't broken.
Nick
[email protected]
Ronnie Babigumira
Yes I have used and continue to use -insheet- (mainly if I
have tab delimited data from excel) and specifying the string
length is not a problem with -insheet-. That said, there are
situations where -infile- is the appropriate command and of
course -input- is invaluable when I want to input a few
entries. In this case I have to specify the length of string
variables
Ada Ma
> have you tried -insheet-??
Ronnie Babigumira
> Is there something in newer versions of Stata that would
save me from guessing the length of strings when using -infile-
> and -input-
*
* 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/
*
* 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/