Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Broca, Sumiter (FAORAP)" <Sumiter.Broca@fao.org> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Graphing monthly (time series) data in STATA 11 |
Date | Sun, 02 May 2010 19:11:16 +0700 |
Dear Statalist, I have the following MONTHLY data on wholesale rice prices (Riel / kg.) in Phnom-Penh, in the format in which they were downloaded (as a CSV file) from http://www.fao.org/giews/pricetool/ . date ricepr 01/01/2006 700 01/02/2006 700 01/03/2006 900 01/04/2006 900 01/05/2006 900 01/06/2006 900 01/07/2006 900 01/08/2006 933.33 01/09/2006 1000 01/10/2006 1000 01/11/2006 1000 01/12/2006 1000 01/01/2007 1050 01/02/2007 1087.5 01/03/2007 1100 01/04/2007 1100 01/05/2007 1100 01/06/2007 1100 01/07/2007 1175 01/08/2007 1200 01/09/2007 1200 01/10/2007 1300 01/11/2007 1400 01/12/2007 1400 1. I read the data into STATA 11 and then changed the "Date" variable into a time variable with the command: gen date2 = date(date, "DMY"). 2. I formatted date2 with the following command: format date2 %td 2. de gives the following output: Contains data obs: 24 vars: 3 size: 528 (99.9% of memory free) ----------------------------------------------------------------------------- ---------------------------- storage display value variable name type format label variable label ----------------------------------------------------------------------------- ---------------------------- date str10 %10s Date ricepr float %8.0g Cambodia, Phnom Penh, Rice (Mix), Wholesale, Riel, Kg date2 float %td ----------------------------------------------------------------------------- ---------------------------- Sorted by: Note: dataset has changed since last saved 3. Then I tried to graph the data with the following command: line ricepr date2. 4. When the graph appeared in the graph window, it had the following (ugly) labels on the x-axis: 01jan2006-------01apr2006---------01jul2006--------01oct2006-----------01jan2 007 5. Ideally I would like to get a nice set of x-axis labels that look like this: J--F--M--A--M--J--J--A--S--O--N--D--J--F--M--A--M--J--J--A--S--O--N--D 2006 2007 5. Or the following, where each tick (|) represents a month, but is not labelled with the month name: | | | | | | | | | | | | | | | | | | | | | | | | | ----------------------------------------------------------------------------- ---------------------------------- 2006 2007 2008 6. I would be grateful for any help from STATALIST members on this matter. Thank you. Sumiter. Sumiter Singh Broca, Policy Officer, Policy Assistance Branch FAO Regional Office for Asia and the Pacific (RAP) Maliwan Mansion, 39 Phra Atit Road Bangkok 10200, Thailand Tel: (66-2) 697-4324 Fax: (66-2) 697-4445 or 697 4409 E-Mail: Sumiter.Broca@fao.org RAP web site: http://www.fao.org/world/regional/rap/index.asp * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/