Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing variables in certain years in a panel from thousands to millions

    Hi,

    My data is as follows:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str14 bvd_id_number str9 original_units float exchange_rate_from_original_curr double(operating_revenue_turnover_ p_l_before_tax)
    "DE5050438829" "millions"  1.1797 1241756755   43885000
    "DE5050438829" "millions"   1.317 1931647618  564598987
    "DE5050438829" "millions"  1.4721 2075807229  428086478
    "DE5050438829" "millions"  1.3917 1654452145 -516877125
    "DE5050438829" "millions"  1.4406   99673695  -22236709
    "DE5050438829" "thousands" 1.3369   44786098  213636372
    "DE5050438829" "thousands" 1.2939 1530166014  747744749
    "DE5050438829" "thousands" 1.3194 1450416368  284726510
    "DE5050438829" "thousands" 1.3791 1530938871  951027336
    "DE5050438829" "millions"  1.2141 2121762207  715226663
    "DE5050438829" "millions"  1.0887 4086979563 1888350040
    "DE5050438829" "millions"  1.0541 6318167351 4068613481
    "DE5050438829" "millions"  1.1993 7857211158 4806073112
    "DE5050438829" "millions"   1.145 8293353679 4436075735
    "DE5050438829" "millions"  1.1234 9052917721 3526239801
    end

    I have selected three variables, but the list runs to about 30. How do I change the units from thousands to millions for each of these variables, but just for the years 2010-2013 that were encoded as thousands.

    Thanks!

    Ciaran

  • #2
    The pattern you want appears to be

    Code:
    clonevar whatever = existing 
    replace whatever = whatever/1000 if original_units == "thousands"
    but I am not seeing that it's obvious anywhere that units really did change.

    Comment

    Working...
    X