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]

st: Breaking huge lines and creating variables


From   Pedro Nakashima <nakashimapedro@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Breaking huge lines and creating variables
Date   Fri, 30 Sep 2011 11:59:11 -0300

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?

Best regards,
Pedro.

*
*   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