Announcement

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

  • US Map in STATA

    Hi,
    I have data that contain state names, very simple data collected from multiple participants. I will just like to highlight where the participants are recruited from using the US map with dots indicating how many were recruited from that State. I tried using the code below but I get the error that the map file is not found.


    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte ParticipantID str20 StateofResidence
     1 "Pennsylvania"        
     2 "Georgia"             
     3 "Pennsylvania"        
     4 "New Jersey"          
     5 "District of Columbia"
     6 "Texas"               
     7 "Pennsylvania"        
     8 "District of Columbia"
     9 "Maryland"            
    10 "Maryland"            
    11 "Maryland"            
    12 "District of Columbia"
    13 "Virginia"            
    14 "Wisconsin"           
    15 "Virginia "           
    16 "North Carolina"      
    17 "Georgia"             
    18 "Maryland"            
    19 "Maryland"            
    20 "North Carolina"      
    21 "Wisconsin"           
    22 "Wisconsin"           
    23 "Wisconsin"           
    24 "Wisconsin"           
    25 "Wisconsin"           
    26 "Wisconsin"           
    27 "Wisconsin"           
    28 "Wisconsin"           
    29 "Wisconsin"           
    30 "Wisconsin"           
    31 "Wisconsin"           
    32 "Wisconsin"           
    33 "Wisconsin"           
    34 "Wisconsin"           
    35 "Wisconsin"           
    36 "Wisconsin"           
    37 "Wisconsin"           
    38 "Wisconsin"           
    39 "Wisconsin"           
    40 "Wisconsin"           
    41 "Wisconsin"           
    42 "Wisconsin"           
    43 "Wisconsin"           
    44 "Wisconsin"           
    45 "Wisconsin"           
    46 "Wisconsin"           
    47 "Wisconsin"           
    48 "Wisconsin"           
    49 "Wisconsin"           
    50 "Wisconsin"           
    51 "Wisconsin"           
    52 "Wisconsin"           
    53 "Wisconsin"           
    54 "Wisconsin"           
    55 "Wisconsin"           
    56 "Wisconsin"           
    57 "Wisconsin"           
    58 "Wisconsin"           
    59 "Wisconsin"           
    60 "Wisconsin"           
    61 "Wisconsin"           
    62 "Wisconsin"           
    63 "Wisconsin"           
    64 "Wisconsin"           
    65 "Wisconsin"           
    66 "Wisconsin"           
    67 "Wisconsin"           
    68 "Wisconsin"           
    69 "Wisconsin"           
    70 "Wisconsin"           
    71 "Wisconsin"           
    72 "Wisconsin"           
    73 "Wisconsin"           
    74 "Wisconsin"           
    75 "Wisconsin"           
    end
    ------------------ copy up to and including the previous line ------------------


    ssc install shp2dta

    shp2dta using s_06se12, database(usdb) coordinates(uscoord) genid(id)

  • #2
    Population centers tend to be concentrated on the coasts, where some states are not large in terms of land area. Therefore, representing frequencies with dots may not be the optimal choice. Using a heatmap or a similar visualization method might be more suitable. For how to generate the map, you need a shape file. See an example here: https://www.statalist.org/forums/for...dummy-variable.

    Comment

    Working...
    X