Bookmark and Share

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]

st: Breaking huge lines and creating variables


From   Pedro Nakashima <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index