Announcement

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

  • Date lable of twoway graph

    Hi together,



    i use stata 16.0 and have a panel data set including banks (unique identifier is the variabel "SNLInsititutionKey") about the 48 continguous United States across quarterly date from 200q1-2019q4 and temperature anomalies (in Fahrenheit desgrees).

    I want run a twoway scatter and lfit for anomalies across the time. By that i only want to show the anomlies from quarter 3 across times. My problem is now how to edit the labels of the x-axis so that the ticks and the lables only showing the quarter 3 of the respective year, i.e. 2000q3, 2001q3, ..., 2019q3? Attached you can see that when the labels of the x-axis show the years with quarter 1 instead of the years with quarter 3.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long SNLInstitutionKey str2 state float(quarterly anomaly)
    100013 "CT" 162 -1.8379288
    100013 "CT" 166   .3620695
    100013 "CT" 170   2.362072
    100013 "CT" 174  1.5287348
    100013 "CT" 178  .32873535
    100013 "CT" 182   2.995403
    100013 "CT" 186   .8954036
    100013 "CT" 190  1.1287371
    100013 "CT" 194   .6620712
    100013 "CT" 198  -.3379326
    100013 "CT" 202   3.095402
    100013 "CT" 206  2.9620705
    100013 "CT" 210  2.3287354
    100013 "CT" 214  1.1954027
    100013 "CT" 218   .4954033
    100013 "CT" 222   3.195403
    100013 "CT" 226   3.928735
    100013 "CT" 230  1.3954023
    100013 "CT" 234   3.995403
    100013 "CT" 238  2.1287358
    100016 "CT" 162 -1.8379288
    100016 "CT" 166   .3620695
    100016 "CT" 170   2.362072
    100016 "CT" 174  1.5287348
    100016 "CT" 178  .32873535
    100016 "CT" 182   2.995403
    100016 "CT" 186   .8954036
    100016 "CT" 190  1.1287371
    100016 "CT" 194   .6620712
    100016 "CT" 198  -.3379326
    100016 "CT" 202   3.095402
    100016 "CT" 206  2.9620705
    100016 "CT" 210  2.3287354
    100016 "CT" 214  1.1954027
    100016 "CT" 218   .4954033
    100016 "CT" 222   3.195403
    100016 "CT" 226   3.928735
    100016 "CT" 230  1.3954023
    100016 "CT" 234   3.995403
    100016 "CT" 238  2.1287358
    100086 "CA" 162   -.194252
    100086 "CA" 166  1.0724131
    100086 "CA" 170    1.50575
    100086 "CA" 174   2.805748
    100086 "CA" 178   .7057495
    100086 "CA" 182   .9724172
    100086 "CA" 186  1.4724172
    100086 "CA" 190   .7724152
    100086 "CA" 194  2.2390823
    100086 "CA" 198   2.405749
    100086 "CA" 202  .57241565
    100086 "CA" 206  1.1390787
    100086 "CA" 210   2.472415
    100086 "CA" 214  1.1724167
    100086 "CA" 218   2.439082
    100086 "CA" 222   1.805748
    100086 "CA" 226  1.4390818
    100086 "CA" 230   2.772418
    100086 "CA" 234   2.972415
    100086 "CA" 238  1.0057501
    100087 "NY" 162   -1.59655
    100087 "NY" 166   .6701164
    100087 "NY" 170   2.936782
    100087 "NY" 174  1.4701144
    100087 "NY" 178  .57011795
    100087 "NY" 182   3.703448
    100087 "NY" 186   .8701159
    100087 "NY" 190  1.0701154
    100087 "NY" 194   .4367828
    100087 "NY" 198  -.5965512
    100087 "NY" 202   2.403449
    100087 "NY" 206   2.770115
    100087 "NY" 210  2.1367836
    100087 "NY" 214   .6701152
    100087 "NY" 218  -.1632169
    100087 "NY" 222   2.436782
    100087 "NY" 226  3.6367836
    100087 "NY" 230   .9034474
    100087 "NY" 234  3.9701145
    100087 "NY" 238  1.6034483
    100088 "CA" 162   -.194252
    100088 "CA" 166  1.0724131
    100088 "CA" 170    1.50575
    100088 "CA" 174   2.805748
    100088 "CA" 178   .7057495
    100088 "CA" 182   .9724172
    100088 "CA" 186  1.4724172
    100088 "CA" 190   .7724152
    100088 "CA" 194  2.2390823
    100088 "CA" 198   2.405749
    100088 "CA" 202  .57241565
    100088 "CA" 206  1.1390787
    100088 "CA" 210   2.472415
    100088 "CA" 214  1.1724167
    100088 "CA" 218   2.439082
    100088 "CA" 222   1.805748
    100088 "CA" 226  1.4390818
    100088 "CA" 230   2.772418
    100088 "CA" 234   2.972415
    100088 "CA" 238  1.0057501
    end
    format %tq quarterly
    Code:
    twoway scatter anomaly quarterly if quarter==3 & yearly>=2000 & yearly<=20019 || lfit anomaly quarterly if quarter==3 & yearly>=2000 & yearly<=20019
    Click image for larger version

Name:	twoway scatter lfit anomaly.png
Views:	1
Size:	61.9 KB
ID:	1562916




    Thanks a lot for your help

    Best regards,
    Lea
Working...
X