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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Sxpose : Process horizontal variables |

Date |
Tue, 15 Apr 2008 15:38:52 +0100 |

Oddly enough, Christian Weiss has exactly the same problem. Pure -xpose- problems are rare in my experience. And only very occasionally is -sxpose- (a user-written command from SSC) the solution otherwise. The main reason for that is the one you give: datasets of this kind usually include both string and numeric variables. You should check out -reshape-. With dataset 1 reshape long Firm, i(Description1) is a first step. Nick n.j.cox@durham.ac.uk P.S. for row sums, use addition (+) or check out -egen-. Richter, Ansgar I am currently working on the following problem and it would be great if someone had 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 values as well as numerical values, neither the "xpose" nor the "sxpose" command seems to be applicable. (Xpose does exactly what I need, however I loose 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 implement this? * * 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/

**References**:**st: Sxpose : Process horizontal variables***From:*"Richter, Ansgar" <Ansgar.Richter@ebs.edu>

- Prev by Date:
**st: Weighted Least Squares** - Next by Date:
**st: RE: Non-linear GMM** - Previous by thread:
**st: Sxpose : Process horizontal variables** - Next by thread:
**st: Dependent continuous variable with bounded range** - Index(es):

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