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]
Re: st: -insheet- doesn't respect quotes
From
"Airey, David C" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: -insheet- doesn't respect quotes
Date
Fri, 20 Aug 2010 10:59:57 -0500
.
I also can't get -insheet- to use quotes around numbers to indicate the content as string, but I can get infile to do that. However, -infile- doesn't have a "names" option.
You could add text to the patient numbers, like "002_p" and -split- it later.
What does insheet do with the quotes in a file? Does it just strip them and then let another demon make the choice of whether the contents are string or not, having no idea quotes were present? <Sigh...reading glasses have been ordered>.
clear
set obs 2
generate str patient_nr = "002"
tempfile tmpfil0
outsheet using `tmpfil0', quote nonames
type `tmpfil0'
infile str3 patient_nr using `tmpfil0', clear
describe
> Is there any way to get -insheet- to respect quoted numbers that have leading
> zeroes? See the example below for illustration of the problem.
>
> -insheet- insists upon importing these strings as numeric. They really should
> be kept as strings, because they are identifiers and are not intended to be
> used in calculations. I can re-generate the strings from the integers using
> -tostring . . ., format(%0X.0f)-, but every extra workaround is one more
> opportunity for errors to arise during data management.
>
> Joseph Coveney
*
* 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/