Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Sxpose : Process horizontal variables


From   Christian Wei� <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Sxpose : Process horizontal variables
Date   Tue, 15 Apr 2008 14:57:56 +0200

Hello! I am currently working on the following problem and it would be great if someone has an idea how to proceed.

I have two datasets (exemplary illustration):

Dataset  1:

                Description1    Firm1           Firm2           Firm3
                -----------------------------------------------
                        xyz             123              456             789
                        abc             321              654             987


Dataset 2:
                Firm            Employees       TotalAssets
                -----           ---------       -----------
                Firm1             123               123

First, I would like to "transpose" this dataset into a vertical order to merge (later on) dataset1 with dataset2. However, as the dataset contains string as well as numeric values neither the "xpose" nor the "sxpose" command helps me.
(Xpose does exactly what I need, however I loos the string values, sxpose (with force option) gives  a "type mismatch" error.
After applying "xpose", Dataset 1 looks a follows: (variable firm was newly created)

Dataset 2_xpose:

Firm  v_1    v_2
----  -----  ---
Firm1  123   321
Firm2  456   654
Firm2  789   987

First Question: Do you have any suggestion how I can prevent that the string-variable ("description") is lost?

Second question:
I would like to calculate the sum of v_1 and v_2 for each row, how can I realize this?

Many thanks for any suggestion!








*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index