Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: insheet, European format, comma


From   "Julian Fennema" <[email protected]>
To   <[email protected]>
Subject   RE: st: insheet, European format, comma
Date   Tue, 30 Aug 2005 12:51:15 +0100

An alternative to this, if you want to do it automatically within a do-file,
is to use the -subinstring- function. I have copied below an example from a
few years ago 

gen str20 temp2=subinstr(v2,"," , "." ,.)
gen str20 totalievgt=temp2
destring totalievgt, replace

Julian

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of lcazals
Sent: 30 August 2005 08:13
To: [email protected]
Subject: Re: st: insheet, European format, comma

--- In [email protected], Henrik Lindegaard <hli@s...> wrote:
> Dear listeners,
>
> I am trying to insheet a file containing rows of data of the
following
> format into Stata 9
>
> "Ringk=F8bing amt";"=D8RE-, N=C6SE- OG HALSAFDELING";"HOLSTEBRO
> CENTRALSYGEHUS";"Oto-, rhino-, laryngologi";8,3;9,7;8,2;6,8;6,6;4,8;
> "=C5rhus amt";"KARDIOLOGISK AFDELING B";"SKEJBY
> SYGEHUS";"Kardiologi";2,7;8,8;5,7;5,7;7,7;13,4;
>
> by using
>
> insheet using "path", delimiter(";") names clear
>
> but unfortunately the data in columns 5 to 10 are imported as
strings
> (probably due to the European format), and I cannot figure out how
to
> change this.
>
> Any suggestions would be welcome!
>
> Henrik
>
>
   Common problem for european users. The easier way to avoid it: using
Excel, apply function "replace" comma by point (replace all) then
save as text file (tab delimited). open stata and import your .txt
file will work fine.

Hope this help..

Laurent

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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index