What Victor wants can be accomplished by:
* Input data 2 composite string variables, broken at the comma
insheet var1 var2 using myfile.csv, comma clear
* Break up the first string at the spaces
gen string1 = word(var1,1)
gen string2 = word(var1,2)
* Note: string2 will have some missing values
* Break up the second string at the spaces
gen string3= word(var2,1)
gen n1= word(var2,2)
gen n2= word(var2,3)
destring n1 n2, replace
* Drop the spare variables
drop var1 var2
HTH
Paul
Fra: [email protected]
[[email protected]] på vegne av Victor M. Zammit
[[email protected]]
> > Sendt: 9. oktober 2008 22:01
> > Til: [email protected]
> > Emne: st: Re:Reading data into Stata
> >
> > Dear Statalist,
> >
> > I need to read into Stata,data that has a comma ,sometimes after
one string
> > variable and sometimes after two,string variables.And after
> >
> > the comma,one string variable and two numeric variables.,always.The
raw list
> > of data is thousands of rows long.Is there a way I could
> >
> > get this raw data into Stata without too much work ? I thank you
for any
> > help you can give me.
> >
> > string , string numeric numeric
> >
> > string string , string numeric numeric
> >
> > string string , string numeric numeric
> >
> > string string , string numeric numeric
> >
> > string , string numeric numeric
> >
> > string string , string numeric numeric
> >
> > Victor Michael Zammit
> >
> >
Paul T Seed MSc CStat, Lecturer in Medical Statistics,
tel (+44) (0) 20 7188 3642, fax (+44) (0) 20 7620 1227
Wednesdays: (+4) (0) 20 7848 4148
[email protected], [email protected]
King's College London, Division of Reproduction and Endocrinology
St Thomas' Hospital, Westminster Bridge Road, London SE1 7EH
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/