Announcement

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

  • Keep observations in a variable

    Dear Statalist community
    I want to select few countries (e.g 5 countries) from the variable: countryname, that has over 200 countries. In other words, i have downloaded an excel file from the worldbank and want a simple way to select the countires of choice using Stata commands.How do i select United Arab Emirates, Bangladesh, Angola, Armenia, Australia and transpose the dataset afterwards? eg of the dataset is provided below:
    Country Name Country Code Indicator Name Indicator Code yr1960 yr2008 yr2009 yr2010 yr2011 yr2012 yr2013 yr2014 yr2015 yr2016 yr2017 yr2018 yr2019
    Aruba ABW Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 8.955987 -2.13543 2.078141 4.316297 0.627472 -2.37207 0.421441 0.474764 -0.9312 -1.02828 3.626041 4.257462
    Afghanistan AFG Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 26.41866 -6.81116 2.178538 11.80419 6.441213 7.385772 4.673996 -0.66171 4.383892 4.975952 0.626149 2.302373
    Angola AGO Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 12.47583 13.73028 14.46966 13.48247 10.2779 8.777814 7.280387 9.150372 30.69531 29.84359 19.62861 17.08122
    Albania ALB Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 3.363138 2.231397 3.622335 3.429123 2.031596 1.937618 1.625865 1.896174 1.275432 1.986661 2.02806 1.411091
    Arab World ARB Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 11.27067 2.920897 3.911062 4.753164 4.611844 3.238108 2.773516 1.814077 2.06884 1.966826 2.458142 1.048834
    United Arab Emirates ARE Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 12.25042 1.561813 0.877983 0.877347 0.662269 1.101118 2.346269 4.069966 1.617488 1.966826 3.068634 -1.93108
    Armenia ARM Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 8.949953 3.406767 8.176361 7.650008 2.55802 5.789668 2.981309 3.731691 -1.40361 0.969553 2.520234 1.443447
    Antigua and Barbuda ATG Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 5.333806 -0.55016 3.370025 3.45675 3.37688 1.059498 1.089442 0.968993 -0.48944 2.432488 1.207158 1.431356
    Australia AUS Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 3.728814 4.350299 1.771117 2.91834 3.30385 1.76278 2.449889 2.487923 1.508367 1.276991 1.948647 1.911401 1.610768
    Austria AUT Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 1.945765 3.21595 0.506308 1.813536 3.286582 2.485674 2.000159 1.605804 0.896565 0.891592 2.081269 1.998382 1.530896
    Azerbaijan AZE Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 20.84909 1.457048 5.726872 7.858333 1.066213 2.415717 1.373442 4.027686 12.44337 12.93592 2.268547 2.610572
    Burundi BDI Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 24.40695 10.55544 6.493266 9.592166 18.16105 7.937958 4.405352 5.544689 5.55769 16.05254 -2.8147 -0.68677
    Belgium BEL Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 0.299467 4.489444 -0.05315 2.189299 3.532082 2.839663 1.113096 0.340003 0.561429 1.973853 2.125971 2.053165 1.43682
    Benin BEN Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 7.947299 0.896072 2.207835 2.704239 6.744683 0.428889 -0.54876 0.218786 -0.79405 1.769412 0.848806 -0.91568
    Burkina Faso BFA Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 7.788162 10.6598 2.608177 -0.76423 2.759767 3.818152 0.533739 -0.25809 0.724839 0.441041 1.482999 1.955943 -3.23339
    Bangladesh BGD Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 8.901945 5.423472 8.126676 11.39517 6.217504 7.530406 6.991639 6.19428 5.513526 5.70207 5.543621 5.591996
    Bulgaria BGR Inflation, consumer prices (annual %) FP.CPI.TOTL.ZG 12.34872 2.753202 2.438991 4.219903 2.954568 0.890094 -1.41818 -0.10463 -0.79875 2.064355 2.811868 3.103729
    Last edited by David KK Botchway; 19 Apr 2021, 23:12.

  • #2
    David:
    welcome to this forum.
    Please read (and act on) the FAQ on how to post (more) effectively and share your data example/excerpt via -dataex-. Thanks.
    That said, you may want to take a look at -if- qualifiier.
    Kind regards,
    Carlo
    (Stata 16.0 SE)

    Comment

    Working...
    X