Announcement

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

  • Scatter plot for multiple variables using a unique identifier

    Hi Everyone

    I appended data from multiple datasets with similar variables and want to plot a graph for some variables over a few other. I also have a weight variable and a unique identifier for each variable contained in the dataset. All the variables are binary (0/1) except for the weight variable and unique identifier. The data is merged from 20 different sources representing 20 countries.

    For one graph, I would like to plot oop_drugs oop_IP oop_OP over cata_nf_40 and cata_tot_10. For the other graph, I want to plot cata_nf_40 cata_tot_10 over hh_nexcap_quintile and hh_urban. I hope to have each indicator for all the countries in the dataset represented by an identifier (ID) which is string. For instance, for the ID variable, Uganda will be "UGA", Cambodia will be "KHM", etc. I also want to apply the population weights [popweight] and label the outputs.

    Please how can I do this in Stata? Any ideas will be most appreciated!

    find below and sample of my dataset

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float popweight byte hh_nexpcap_quintile float(oop_drugs oop_OP oop_IP cata_nf_40 cata_tot_10 hh_urban) str3 ID
     8377 5 0 0 1 . 1 0 "UGA"
     8377 5 0 0 0 . 1 0 "UGA"
     8377 3 1 0 0 . 1 0 "UGA"
     9373 5 0 0 1 . 0 1 "UGA"
     3749 5 1 0 0 . 0 1 "UGA"
     1874 5 1 0 0 . 0 1 "UGA"
     7499 4 1 0 0 . 0 1 "UGA"
    11248 5 1 0 0 . 0 1 "UGA"
    11248 5 1 0 0 . 0 1 "UGA"
    11248 4 1 0 0 . 0 1 "UGA"
     7499 5 0 0 1 . 0 1 "UGA"
    11248 5 1 0 0 . 0 1 "UGA"
    16873 5 0 1 0 . 0 1 "UGA"
    16873 5 1 0 0 . 0 1 "UGA"
    16873 5 0 0 1 . 0 1 "UGA"
     1874 5 0 1 0 . 0 1 "UGA"
     1874 5 1 0 0 . 0 1 "UGA"
     1874 5 0 0 1 . 0 1 "UGA"
     9373 5 1 0 0 . 0 1 "UGA"
     2499 4 0 0 1 . 0 1 "UGA"
     3124 5 1 0 0 . 0 1 "UGA"
     7499 5 1 0 0 . 1 1 "UGA"
    11248 4 1 0 0 . 1 1 "UGA"
    11248 4 0 0 1 . 1 1 "UGA"
     1874 5 1 0 0 . 1 1 "UGA"
     5624 5 0 1 0 . 1 1 "UGA"
     5624 5 1 0 0 . 1 1 "UGA"
    11248 5 1 0 0 . 1 1 "UGA"
    11248 5 0 0 1 . 1 1 "UGA"
     9373 4 1 0 0 . 0 1 "UGA"
    11248 5 1 0 0 . 0 1 "UGA"
     4686 4 1 0 0 . 0 1 "UGA"
    13123 5 1 0 0 . 0 1 "UGA"
     9373 5 1 0 0 . 0 1 "UGA"
     9373 5 0 0 1 . 0 1 "UGA"
     7499 5 1 0 0 . 0 1 "UGA"
     7499 5 0 0 1 . 0 1 "UGA"
    20622 4 1 0 0 . 0 1 "UGA"
    11248 4 1 0 0 . 0 1 "UGA"
    11248 5 1 0 0 . 0 1 "UGA"
     3749 5 1 0 0 . 0 0 "UGA"
     7499 5 0 1 0 . 0 1 "UGA"
     7499 5 1 0 0 . 0 1 "UGA"
     7499 5 0 0 1 . 0 1 "UGA"
     7499 5 1 0 0 . 0 1 "UGA"
     1874 5 1 0 0 . 0 0 "UGA"
    20622 5 0 1 0 . 0 1 "UGA"
    20622 5 1 0 0 . 0 1 "UGA"
     2812 5 1 0 0 . 0 1 "UGA"
     7499 5 1 0 0 . 0 1 "UGA"
     2812 5 1 0 0 . 0 1 "UGA"
     5624 5 1 0 0 . 0 1 "UGA"
    13123 4 0 1 0 . 0 1 "UGA"
    13123 4 1 0 0 . 0 1 "UGA"
     3749 5 1 0 0 . 0 1 "UGA"
    13123 5 1 0 0 . 1 1 "UGA"
    13123 5 0 0 1 . 1 1 "UGA"
     5624 5 1 0 0 . 0 1 "UGA"
     9373 4 1 0 0 . 0 0 "UGA"
     9373 5 1 0 0 . 0 1 "UGA"
    10206 4 1 0 0 . 0 0 "UGA"
    25517 2 0 0 1 . 1 0 "UGA"
    10206 5 1 0 0 . 0 0 "UGA"
     7655 3 1 0 0 . 0 0 "UGA"
     4252 4 1 0 0 . 1 0 "UGA"
    10206 3 0 0 1 . 0 0 "UGA"
    17861 4 0 0 1 . 0 0 "UGA"
    15310 4 1 0 0 . 0 0 "UGA"
    15310 4 0 0 0 . 0 0 "UGA"
    10206 5 1 0 0 . 1 0 "UGA"
    10206 5 0 0 0 . 1 0 "UGA"
    15310 4 0 0 1 . 0 0 "UGA"
     8930 4 1 0 0 . 0 0 "UGA"
     1275 5 1 0 0 . 0 1 "UGA"
    10206 3 1 0 0 . 1 0 "UGA"
     2551 3 1 0 0 . 1 0 "UGA"
     2551 3 0 0 1 . 0 0 "UGA"
    15310 5 1 0 0 . 0 1 "UGA"
    12758 3 0 0 1 . 0 1 "UGA"
    15310 4 1 0 0 . 0 1 "UGA"
    10206 4 1 0 0 . 0 0 "UGA"
    17861 4 1 0 0 . 0 0 "UGA"
    17861 4 0 0 1 . 0 0 "UGA"
    10206 5 1 0 0 . 0 0 "UGA"
    12758 4 0 0 1 . 0 0 "UGA"
    11482 4 1 0 0 . 0 0 "UGA"
    28068 5 0 0 1 . 0 0 "UGA"
    15310 4 1 0 0 . 1 0 "UGA"
     7655 3 0 0 1 . 0 0 "UGA"
     1701 5 1 0 0 . 0 1 "UGA"
     7655 4 0 0 1 . 0 1 "UGA"
    20413 1 1 0 0 . 0 0 "UGA"
     5103 4 1 0 0 . 0 0 "UGA"
     2551 4 0 0 1 . 1 0 "UGA"
     2551 4 0 0 0 . 1 0 "UGA"
     1275 5 1 0 0 . 0 0 "UGA"
     7655 5 1 0 0 . 0 1 "UGA"
    30620 3 1 0 0 . 0 0 "UGA"
    10206 5 0 0 1 . 0 1 "UGA"
    10206 5 0 0 0 . 0 1 "UGA"
    end
    label values hh_nexpcap_quintile hh_nexpcap_quintile
    label def hh_nexpcap_quintile 1 "poorest", modify
    label def hh_nexpcap_quintile 2 "poorer", modify
    label def hh_nexpcap_quintile 3 "middle", modify
    label def hh_nexpcap_quintile 4 "richer", modify
    label def hh_nexpcap_quintile 5 "richest", modify

    Thanks again!
Working...
X