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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Breaking huge lines and creating variables


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Breaking huge lines and creating variables
Date   Fri, 30 Sep 2011 16:04:10 +0100

Please don't show an abstraction. Show us a concrete example.

It all depends on the length of the lines, which you don't give. If
this can be read into one or more string variables, Mata may not be
necessary.

Nick

Nick

On Fri, Sep 30, 2011 at 3:59 PM, Pedro Nakashima
<nakashimapedro@gmail.com> wrote:
> Dear statalisters,
>
> My current database(it's in .txt) has a typical line in the form :
>
> cod1=time1   cod2=...  cod3=n   cod4=type1   cod5=quantity1
> cod6=price1   cod4=type2   cod5=quantity2   cod6=price2
>
> cod3=n (n=2 in this case, and n varies through lines) says that
> following this code, that are 2 records, each of them starts with
> cod4=type. For example:
> cod4=type1   cod5=quantity1   cod6=price1         and
> cod4=type2   cod5=quantity2   cod6=price2          are records.
>
> I want to generate a new database in the form:
>
> cod1     cod4      cod5         cod6
> time1    type1    quantity1    price1
> time1    type2    quantity2    price2
>
> I think it's only possible to do that with Mata given the lenghs of
> the lines, is it right?
>
> Can anyone give me a direction?

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index