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   Thu, 15 Dec 2005 21:30:42 -0000

I would endorse -split- here. You 
can use the -destring- option. 

Also note -destring- command for the elimination 
of parentheses. 

Nick 
[email protected] 

Richard Goldstein
 
> use the -split- command on your three variables; then use the 
> substr function 
> to strip off the parentheses from the year variable
 
> b. water wrote:
 
> > Stata 8.2 Window XP Pro SP2.
> > 
> > I want to import into Stata a data set saved as a text file, which 
> > contained data in the following structure:
> > 
> > Abrams (1999)    0/31    5/232
> > Greenland (1996)    115/2131    123/8751
> > Di Arozio (1999)    4/12    21/483
> > 
> > i.e. authors space year (in bracket) tab number nospace 
> forward/slash 
> > nospace number tab number nospace forward/slash nospace 
> number. I want 
> > to end up with six columns of variables in Stata i.e. authors year 
> > (without brackets) number number number number.
> > 
> > I am at lost as to what to do with what looks like a very 
> structured 
> > data set and should be able to be accomplished without 
> difficulty. I 
> > checked [U] 24 Commands to input data and [R] infile, infix 
> and insheet 
> > for help but without success.
> > 
> > I tried to copy and paste into stata editor and ended up with three 
> > columns of variable i.e. authors and years, number/number and 
> > number/number. In this situation, I do not know how (beyond me - to 
> > create a do-file) to 'clean' the data e.g. 'demerging' 
> authors and years 
> > from one column to two columns and likewise for 
> number/number from one 
> > column to number number in two separate columns.

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