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 limit in string
Nick Cox <firstname.lastname@example.org>
Re: st: insheet limit in string
Fri, 9 Dec 2011 09:00:53 +0000
Sounds as if you need some kind of pre-processing to put those
variables somewhere else. The Mata-based
programs I posted in September may be suggestive.
On Fri, Dec 9, 2011 at 4:19 AM, Mike Kim <email@example.com> wrote:
> Thanks, Nick and Matt.
> Matt, your suggestion works with the simple example below, but it does not
> work with my actual data. I have many variables to the right of 'school'
> variable. If I use the code you suggested, split ones push other
> observations to the right and variables are all mixed. Strange. Well, thanks
> anyway. I really appreciate your help.
> -----Original Message-----
> From: firstname.lastname@example.org
> [mailto:email@example.com] On Behalf Of Matthew White
> Sent: Thursday, December 08, 2011 6:09 PM
> To: firstname.lastname@example.org
> Subject: Re: st: insheet limit in string
> Hi Mike,
> With -filefilter-, you probably want to change "; [" to the delimiter.
> For example, if mydata.csv is comma-delimited, you should change "; ["
> to `"",""' (since you're working with strings). Let's say mydata.csv
> looks like this:
> ***BEGIN .CSV***
> "Novicevic, MM; Humphreys, JH; Buckley, MR; Cagle, C; Roberts,
> F","[Buckley, MR] Univ Oklahoma, Michael F Price Coll Business,
> Norman, OK 73019 USA; [Novicevic, MM; Roberts, F] Univ Mississippi,
> Sch Business Adm, University, MS 38677 USA; [Humphreys, JH] Texas A&M
> Univ, Commerce, TX 75429 USA; [Cagle, C] Univ Mississippi, Sch
> Accountancy, University, MS 38677 USA"
> Then in Stata:
> filefilter mydata.csv mydata_split.csv, from("; [") to(`"",""') replace
> insheet using mydata_split.csv, comma names clear
> Does that work? Also, if you're working with many files, think about
> using the -:dir- extended macro function: -help extended_fcn-.
> On Thu, Dec 8, 2011 at 6:30 PM, Mike Kim <email@example.com> wrote:
>> Hi Matt,
>> Yes, I tried filefilter, etc. but it didn't work. For example, I changed
>> [" into "^" or "???"and used insheet. The result is completely mess (with
>> or error (with ???). Does delimiter option in insheet work only with one
>> variable? If data has several variable, the imported data becomes total
>> with delimiter option. Then, maybe the only option is to save my school
>> variable as a separate file and import using delimit option and merge
>> I have 40 of these files to import, but it is doable. The only question
>> is... why does Stata create this pain?
>> -----Original Message-----
>> From: firstname.lastname@example.org
>> [mailto:email@example.com] On Behalf Of Matthew White
>> Sent: Thursday, December 08, 2011 4:22 PM
>> To: firstname.lastname@example.org
>> Subject: Re: st: insheet limit in string
>> Hi Mike,
>> There was a discussion about a similar problem not too long ago.
>> Google "String variables over 244 in a dataset with two delimiters"
>> and see if that helps.
>> On Thu, Dec 8, 2011 at 5:05 PM, Mike Kim <email@example.com> wrote:
>>> Hi all,
>>> I am using Stata IC v.11 and trying to import data using:
>>> insheet using mydata.csv, clear
>>> However, due to 244 string limit, I cannot correctly import the following
>>> example. I cannot use delimit(;) option because it changes the data
>>> structure I intended. If I can split school variable using delimit(";
>>> it will work, but Stata does not allow this. Is there any way I can
>>> more than 244 string? Can Stata 12 handle large string variables? Thank
>>> in advance.
>>> input str244 author str244 school
>>> "Novicevic, MM; Humphreys, JH; Buckley, MR; Cagle, C; Roberts, F"
>>> "[Buckley, MR] Univ Oklahoma, Michael F Price Coll Business, Norman, OK
>>> 73019 USA; [Novicevic, MM; Roberts, F] Univ Mississippi, Sch Business
>>> University, MS 38677 USA; [Humphreys, JH] Texas A&M Univ, Commerce, TX
>>> USA; [Cagle, C] Univ Mississippi, Sch Accountancy, University, MS 38677
* For searches and help try: