Announcement

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

  • Help forPlot

    So I have data in one variable 'months' '=as blue coded int labeled as string and one variable as float, I want to plot them but I want the x axis as the strings (months name).
    month unemployment_rate
    january .0351568
    february .0351279
    march .0338469
    april .0294022
    may .0316716
    june .035098
    july .0345049

    please help

  • #2
    Please read #12 in the FAQ https://www.statalist.org/forums/help#stata for advice on showing data examples. We can't see how the value labels are defined. Here is one take from what you have posted.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str8 month double unemployment
    "january"  .0351568
    "february" .0351279
    "march"    .0338469
    "april"    .0294022
    "may"      .0316716
    "june"      .035098
    "july"     .0345049
    end
    
    gen t  = _n
    
    tokenize "`c(Months)'"
    
    forval m = 1/12 {
       label def months `m' "``m''", add
    }
    
    label val t months
    
    twoway connected unemployment t , xla(1/7, valuelabels) xtitle("")
    Click image for larger version

Name:	unemploy.png
Views:	1
Size:	36.8 KB
ID:	1726071

    Comment

    Working...
    X