Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RES: RE: comas in numbrers


From   José Maria Pacheco de Souza <[email protected]>
To   <[email protected]>
Subject   st: RES: RE: comas in numbrers
Date   Sun, 2 May 2010 20:20:56 -0300

<>
Probably someone in the list will give a better explanation than mine. I
assumed two possibilities about your data and proceeded in these ways:
    1. Eight observations (rows), nine variables. The comma is a separator
of the integer part; for example, 15,127 is the same as 15,127000 and in
U.S. notation corresponds to 15.127; copy paste using an editor (in my case
the wordpad), substitute "." in place of ",". Save as dot.txt, in Stata call
file, import, unformatted ASCII data, call dot.txt, complete new variable
names (var1-var9 will do),replace data in memory, enter. 
I got  
    . infile var1-var9 using "C:\temp\dot.txt", clear
(8 observations read)
     
         var1     var2     var3     var4     var5     var6     var7     var8
var9 |
 
|---------------------------------------------------------------------------
-----|
  1. | 31.666   15.127   46.793   31.259   15.409   46.668   30.215   17.182
7.397 |
  2. | 28.323   13.798   42.121   28.267   14.024   42.291   27.049   15.886
2.935 |
  3. |  6.615    2.307    8.922    6.668    2.602     9.27     6.13     3.38
9.51 |
  4. |  7.829    4.196   12.025    7.556    3.855   11.411     7.02    4.336
11.356 |
  5. |  5.583    2.809    8.392    6.098    2.856    8.954    6.177    3.145
9.322 |
 
|---------------------------------------------------------------------------
-----|
  6. |  4.399    2.421     6.82    4.311     2.52    6.831    4.119    2.609
6.728 |
  7. |  3.897    2.065    5.962    3.634    2.191    5.825    3.603    2.416
6.019 |
  8. |  3.343    1.329    4.672    2.992    1.385    4.377    3.166    1.296
4.462 |

    2. The comma is not a separator of the integer part; for example, 31,666
is 31666, 15,127 is the same as 15127 etc.; copy paste using the editor,
substitute " " in place of ",". Save as nodotnocomma.txt, in Stata call
file, import, unformatted ASCII data, call nodotnocomma.txt, complete new
variable names (var1-var9),replace data in memory, enter.
I got
infile var1-var9 using "C:\temp\nodotnocomma.txt", clear
(8 observations read)
 
+-----------------------------------------------------------------------+
     |  var1    var2    var3    var4    var5    var6    var7    var8    var9
|
 
|-----------------------------------------------------------------------|
  1. | 31666   15127   46793   31259   15409   46668   30215   17182    7397
|
  2. | 28323   13798   42121   28267   14024   42291   27049   15886    2935
|
  3. |  6615    2307    8922    6668    2602    9270    6130    3380    9510
|
  4. |  7829    4196   12025    7556    3855   11411    7020    4336   11356
|
  5. |  5583    2809    8392    6098    2856    8954    6177    3145    9322
|
 
|-----------------------------------------------------------------------|
  6. |  4399    2421    6820    4311    2520    6831    4119    2609    6728
|
  7. |  3897    2065    5962    3634    2191    5825    3603    2416    6019
|
  8. |  3343    1329    4672    2992    1385    4377    3166    1296    4462
|
 
+-----------------------------------------------------------------------+

   Best wishes.
José Maria

José Maria Pacheco de Souza ; Professor Titular, aposentado; Colaborador
Sênior
Departamento de Epidemiologia/Faculdade de Saúde Pública/Universidade de São
Paulo
Av. Dr. Arnaldo, 715 - São Paulo, Capital - cep 01246-904
Fone FSP= (11)3061-7747 Res= (11)3714-2403
www.fsp.usp.br/~jmpsouza


Thanks Steve ,however I seem to be doing something wrong with processing
the following data into a file calling it file1.txt. I am doing this by
highlighting the data,copy it and paste it into a do-file and then
saving it as file1.txt.       .....

 31,666 15,127 46,793 31,259 15,409 46,668 30,215 17,182 7,397
 28,323 13,798 42,121 28,267 14,024 42,291 27,049 15,886 2,935
 6,615 2,307 8,922 6,668 2,602 9,270 6,130 3,380 9,510
 
Contains data
  obs:             0
 vars:             0
 size:             0 (100.0% of memory free)
Sorted by:

 list

..
end of do-file





*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index