Note that there are some explanatory texts on larger screens.

plurals
  1. POCarrying string labels of string variable after reshape
    primarykey
    data
    text
    <p>I have dataset in Stata that looks like this</p> <pre><code>entityID indicator indicatordescr indicatorvalue 1 gdp Gross Domestic 100 1 pop Population 15 1 area Area 50 2 gdp Gross Domestic 200 2 pop Population 10 2 area Area 300 </code></pre> <p>and there is a one-to-one mapping between values of <code>indicator</code> and values of <code>indicatordescr</code>.</p> <p>I want to reshape it to wide, i.e. to:</p> <pre><code>entityID gdp pop area 1 100 15 50 2 200 10 300 </code></pre> <p>where I would like <code>gdp</code> variable label to be "Gross Domestic", <code>pop</code> label "Population" and <code>area</code> "Area".</p> <p>Unfortunately, as I understand, it is not possible to assign the value of <code>indicatordescr</code> as a value label of <code>indicator</code>, so the reshape can't transform these value labels into variable labels.</p> <p>I have looked at this : <a href="https://stackoverflow.com/questions/18236066/bring-value-labels-to-variable-labels-when-reshaping-wide">Bring value labels to variable labels when reshaping wide</a></p> <p>and this : <a href="http://www.stata.com/support/faqs/data-management/apply-labels-after-reshape/" rel="nofollow noreferrer">http://www.stata.com/support/faqs/data-management/apply-labels-after-reshape/</a></p> <p>but did not understand how to apply those to my case.</p> <p>NB: the variable labeling after reshape must be done programatically, because <code>indicator</code> and <code>indicatordescr</code> have many values.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload