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]

Re: st: insheet and strings


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: insheet and strings
Date   Fri, 8 Mar 2013 13:21:11 +0000

I doubt it. -insheet- is intended largely to map from spreadsheet
ideas to statistical software ideas to the extent possible, which
includes a built-in bias to believe that your variables are numeric.

You could convert such variables back to string with

tostring myvar, format("%02.0f")

Nick

On Fri, Mar 8, 2013 at 1:12 PM, Sonja Wehberg
<Sonja.Wehberg@ouh.regionsyddanmark.dk> wrote:

> I frequently use insheet. Unfortunately it sometimes converts string variables. Can I prevent that (without adding an alphanumeric suffix)?
>
> Example (version 12):
>
> input x str2 s
> 1 "04"
> 2 "10"
> end
> list
> format s
>
> outsheet using "test.csv", delim(";") replace
> insheet using "test.csv", clear delim(";")
> format s
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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