Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: comas in numbrers


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: comas in numbrers
Date   Wed, 28 Apr 2010 11:11:51 +0100

Steve gave good advice. In addition any decent text editor will do this,
as will Stata. See -filefilter-. 

Nick 
n.j.cox@durham.ac.uk 

Steve Samuels

Victor, you can skip all the problems of adding quotes or destringing
by deleting the commas outside of Stata. Use the SED package, built
into all the Unix, Linux, and OS X distributions and also available
for Windows.  Write the data into a text file, say file1.txt.  Here is
an example:

**************************CODE BEGINS**************************
/*
 File file1.txt contains the following two lines with three variables
3,000,000 4,000,000    .
     40,000   300,000 100
*/
capture erase file2.txt
! sed  -e 's/,//g' file1.txt>file2.txt

infile v1 v2 v3 using file2.txt, clear
des
list
***************************CODE ENDS**************************



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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index