Statalist


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

Re: st: insheet delimiter problem


From   Neil Shephard <[email protected]>
To   [email protected]
Subject   Re: st: insheet delimiter problem
Date   Mon, 10 Nov 2008 11:58:10 +0000

Ada Ma wrote:
> Hi Statalist,
>
> Is there a way to stop Stata seeing double quotes as delimiters?  I
> have data files in txt format, the data is pipe (|) delimited, but the
> people who generated the data also use double quotes (") to specify
> missing variables so I got a large number of pipes with a couple of
> double quotes I find in the txt files.
>
> I can read the data in Stata fine - only if I open up the text files
> and remove all the double quotes before I -insheet- the data with pipe
> specified as the delimiter.  If would be nice if I don't have to check
> for double quotes first because it would save me the time opening up
> the data files twice - first for getting rid of double quotes and
> another for reading it into Stata.
>   
Without seeing an example I don't understand the problem.  It sounds as
though you are using the -delimiter("char")- option, e.g.

insheet using [path/to/your/file/filename], delim("|") clear

So its irrelevant what the people who generated the data used to sepcify
the missing variable (which you indicate to be double quotes), the
delimiter is "|" and is explicitly defined and anything between these
delimiteres is considered by Stata to be a variable.

This may result in some data that is intended to be numeric being read
as string, but you can -destring- or otherwise convert afterwards.

Neil

-- 
"We should make things as simple as possible, but not simpler" - Anon (not Albert Einstein)


***********************************************************************
This  message  may  contain  confidential and  privileged  information.
If you  are not the  intended recipient  you should not  disclose, copy
or distribute information in this e-mail or take any action in reliance
on its contents.  To do so is strictly  prohibited and may be unlawful.
Please  inform  the  sender that  this  message has  gone astray before
deleting it.  Thank you.

2008 marks the 60th anniversary of the NHS.  It's an opportunity to pay
tribute to the NHS staff and volunteers who help shape the service, and
celebrate their achievements.

If you work for the NHS  and  would like  an NHSmail  email account, go
to: www.connectingforhealth.nhs.uk/nhsmail
***********************************************************************

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index