BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JacquesR
Quartz | Level 8

I am trying to plot some time series, I have resolved all my issues (with a combination of help files and internet searching) barring this one.

The values are summarised by year-month. The PlotDate variable is set to the first of every respective year-month.

SAS SGPLOT currently plots the date on a single line, I would like two lines, month on the first, year on the second, like Figure 3.8 from this example:

http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_tsdata_sect028...

I have tried variations on FITPOLICY and VALUESFORMAT, but that has not helped.

 

Thanks in advance

 

data test;
input Substance $ StudyYear NPoisonings_pre NDeaths_pre NPoisonings_int NDeaths_int NPoisonings_post NDeaths_post PlotDate :yymmdd10.;
format PlotDate YYMMD.;
datalines;
Dimethoate 2002 4 2 . . . . 2002/04/01
Dimethoate 2002 7 2 . . . . 2002/05/01
Dimethoate 2002 7 1 . . . . 2002/06/01
Dimethoate 2002 12 3 . . . . 2002/07/01
Dimethoate 2002 12 4 . . . . 2002/08/01
Dimethoate 2002 8 0 . . . . 2002/09/01
Dimethoate 2002 11 4 . . . . 2002/10/01
Dimethoate 2002 13 4 . . . . 2002/11/01
Dimethoate 2002 8 1 . . . . 2002/12/01
Dimethoate 2003 19 2 . . . . 2003/01/01
Dimethoate 2003 14 2 . . . . 2003/02/01
Dimethoate 2003 2 0 . . . . 2003/03/01
Dimethoate 2003 2 0 . . . . 2003/06/01
Dimethoate 2003 15 3 . . . . 2003/07/01
Dimethoate 2003 10 0 . . . . 2003/08/01
Dimethoate 2003 14 1 . . . . 2003/09/01
Dimethoate 2003 8 2 . . . . 2003/10/01
Dimethoate 2003 12 2 . . . . 2003/11/01
Dimethoate 2003 9 4 . . . . 2003/12/01
Dimethoate 2004 18 4 . . . . 2004/01/01
Dimethoate 2004 22 10 . . . . 2004/02/01
Dimethoate 2004 4 1 . . . . 2004/03/01
Dimethoate 2004 23 5 . . . . 2004/04/01
Dimethoate 2004 9 4 . . . . 2004/05/01
Dimethoate 2004 11 1 . . . . 2004/06/01
Dimethoate 2004 15 4 . . . . 2004/07/01
Dimethoate 2004 9 1 . . . . 2004/08/01
Dimethoate 2004 13 7 . . . . 2004/09/01
Dimethoate 2004 12 3 . . . . 2004/10/01
Dimethoate 2004 20 1 . . . . 2004/11/01
Dimethoate 2004 5 0 . . . . 2004/12/01
Dimethoate 2005 1 0 . . . . 2005/01/01
Dimethoate 2005 8 1 . . . . 2005/02/01
Dimethoate 2005 18 7 . . . . 2005/03/01
Dimethoate 2005 14 3 . . . . 2005/04/01
Dimethoate 2005 10 2 . . . . 2005/05/01
Dimethoate 2005 8 1 . . . . 2005/06/01
Dimethoate 2005 15 2 . . . . 2005/07/01
Dimethoate 2005 10 4 . . . . 2005/08/01
Dimethoate 2005 8 2 . . . . 2005/09/01
Dimethoate 2005 7 2 . . . . 2005/10/01
Dimethoate 2005 10 3 . . . . 2005/11/01
Dimethoate 2005 17 6 . . . . 2005/12/01
Dimethoate 2006 12 2 . . . . 2006/01/01
Dimethoate 2006 13 2 . . . . 2006/02/01
Dimethoate 2006 14 5 . . . . 2006/03/01
Dimethoate 2006 8 2 . . . . 2006/04/01
Dimethoate 2006 11 1 . . . . 2006/05/01
Dimethoate 2006 11 2 . . . . 2006/06/01
Dimethoate 2006 9 1 . . . . 2006/07/01
Dimethoate 2006 10 0 . . . . 2006/08/01
Dimethoate 2006 10 0 . . . . 2006/09/01
Dimethoate 2006 10 1 . . . . 2006/10/01
Dimethoate 2006 7 1 . . . . 2006/11/01
Dimethoate 2006 12 1 . . . . 2006/12/01
Dimethoate 2007 24 3 . . . . 2007/01/01
Dimethoate 2007 19 5 . . . . 2007/02/01
Dimethoate 2007 16 2 . . . . 2007/03/01
Dimethoate 2007 13 2 . . . . 2007/04/01
Dimethoate 2007 15 4 . . . . 2007/05/01
Dimethoate 2007 5 0 . . . . 2007/06/01
Dimethoate 2007 16 5 . . . . 2007/07/01
Dimethoate 2007 14 2 . . . . 2007/08/01
Dimethoate 2007 23 3 . . . . 2007/09/01
Dimethoate 2007 13 2 . . . . 2007/10/01
Dimethoate 2007 14 4 . . . . 2007/11/01
Dimethoate 2007 18 5 . . . . 2007/12/01
Dimethoate 2008 25 3 . . . . 2008/01/01
Dimethoate 2008 20 4 . . . . 2008/02/01
Dimethoate 2008 12 3 . . . . 2008/03/01
Dimethoate 2008 12 4 . . . . 2008/04/01
Dimethoate 2008 27 4 . . . . 2008/05/01
Dimethoate 2008 11 3 . . . . 2008/06/01
Dimethoate 2008 11 1 . . . . 2008/07/01
Dimethoate 2008 16 1 . . . . 2008/08/01
Dimethoate 2008 7 1 . . . . 2008/09/01
Dimethoate 2008 15 1 . . . . 2008/10/01
Dimethoate 2008 7 1 . . . . 2008/11/01
Dimethoate 2008 14 5 . . . . 2008/12/01
Dimethoate 2009 10 0 . . . . 2009/01/01
Dimethoate 2009 9 0 . . . . 2009/02/01
Dimethoate 2009 11 2 . . . . 2009/03/01
Dimethoate 2009 7 0 . . . . 2009/04/01
Dimethoate 2009 5 1 . . . . 2009/05/01
Dimethoate 2009 11 0 . . . . 2009/06/01
Dimethoate 2009 7 1 . . . . 2009/07/01
Dimethoate 2009 5 1 . . . . 2009/08/01
Dimethoate 2009 5 0 . . . . 2009/09/01
Dimethoate 2009 9 1 . . . . 2009/10/01
Dimethoate 2009 6 1 . . . . 2009/11/01
Dimethoate 2009 5 0 . . . . 2009/12/01
Dimethoate 2010 2 0 . . . . 2010/01/01
Dimethoate 2010 6 1 . . . . 2010/02/01
Dimethoate 2010 5 0 . . . . 2010/04/01
Dimethoate 2010 1 0 . . . . 2010/05/01
Dimethoate 2010 2 0 . . . . 2010/06/01
Dimethoate 2010 1 1 . . . . 2010/07/01
Dimethoate 2010 3 0 . . . . 2010/08/01
Dimethoate 2010 3 0 . . . . 2010/09/01
Dimethoate 2010 5 0 . . . . 2010/10/01
Dimethoate 2010 4 0 . . . . 2010/11/01
Dimethoate 2010 1 0 . . . . 2010/12/01
Dimethoate 2011 . . 2 0 . . 2011/01/01
Dimethoate 2011 . . 2 0 . . 2011/02/01
Dimethoate 2011 . . 1 0 . . 2011/03/01
Dimethoate 2011 . . 2 0 . . 2011/04/01
Dimethoate 2011 . . 2 0 . . 2011/05/01
Dimethoate 2011 . . 2 0 . . 2011/06/01
Dimethoate 2011 . . 1 0 . . 2011/07/01
Dimethoate 2011 . . 1 1 . . 2011/08/01
Dimethoate 2011 . . 1 0 . . 2011/12/01
Dimethoate 2012 . . . . 1 0 2012/01/01
Dimethoate 2012 . . . . 1 0 2012/02/01
Dimethoate 2012 . . . . 1 0 2012/03/01
Dimethoate 2012 . . . . 1 0 2012/04/01
Dimethoate 2012 . . . . 3 1 2012/05/01
Dimethoate 2012 . . . . 1 0 2012/06/01
Dimethoate 2012 . . . . 1 0 2012/07/01
Dimethoate 2012 . . . . 4 0 2012/09/01
Dimethoate 2012 . . . . 2 0 2012/10/01
Dimethoate 2012 . . . . 1 0 2012/11/01
Dimethoate 2013 . . . . 1 0 2013/02/01
Dimethoate 2013 . . . . 1 0 2013/03/01
Dimethoate 2013 . . . . 2 0 2013/10/01
Dimethoate 2014 . . . . 1 1 2014/01/01
Dimethoate 2014 . . . . 1 0 2014/02/01
Dimethoate 2014 . . . . 1 0 2014/05/01
Dimethoate 2014 . . . . 1 0 2014/06/01
Dimethoate 2015 . . . . 1 1 2015/01/01
Dimethoate 2016 . . . . 1 0 2016/03/01
Dimethoate 2016 . . . . 1 0 2016/05/01
Dimethoate 2016 . . . . 1 1 2016/07/01
Dimethoate 2016 . . . . 1 0 2016/08/01
Dimethoate 2017 . . . . 2 0 2017/03/01
Dimethoate 2017 . . . . 1 0 2017/04/01
Fenthion 2002 2 1 . . . . 2002/03/01
Fenthion 2002 4 1 . . . . 2002/04/01
Fenthion 2002 3 1 . . . . 2002/05/01
Fenthion 2002 5 0 . . . . 2002/06/01
Fenthion 2002 3 0 . . . . 2002/07/01
Fenthion 2002 7 1 . . . . 2002/08/01
Fenthion 2002 3 1 . . . . 2002/09/01
Fenthion 2002 7 0 . . . . 2002/10/01
Fenthion 2002 4 0 . . . . 2002/11/01
Fenthion 2002 5 1 . . . . 2002/12/01
Fenthion 2003 4 2 . . . . 2003/01/01
Fenthion 2003 6 1 . . . . 2003/02/01
Fenthion 2003 4 0 . . . . 2003/03/01
Fenthion 2003 1 0 . . . . 2003/06/01
Fenthion 2003 6 2 . . . . 2003/07/01
Fenthion 2003 5 0 . . . . 2003/08/01
Fenthion 2003 6 0 . . . . 2003/09/01
Fenthion 2003 5 0 . . . . 2003/10/01
Fenthion 2003 4 1 . . . . 2003/11/01
Fenthion 2004 1 0 . . . . 2004/01/01
Fenthion 2004 3 1 . . . . 2004/02/01
Fenthion 2004 4 0 . . . . 2004/03/01
Fenthion 2004 6 1 . . . . 2004/04/01
Fenthion 2004 4 0 . . . . 2004/05/01
Fenthion 2004 5 0 . . . . 2004/06/01
Fenthion 2004 9 2 . . . . 2004/07/01
Fenthion 2004 2 0 . . . . 2004/08/01
Fenthion 2004 3 0 . . . . 2004/09/01
Fenthion 2004 5 1 . . . . 2004/10/01
Fenthion 2004 2 0 . . . . 2004/11/01
Fenthion 2004 2 1 . . . . 2004/12/01
Fenthion 2005 5 0 . . . . 2005/02/01
Fenthion 2005 3 0 . . . . 2005/03/01
Fenthion 2005 6 1 . . . . 2005/04/01
Fenthion 2005 7 2 . . . . 2005/05/01
Fenthion 2005 8 0 . . . . 2005/06/01
Fenthion 2005 3 0 . . . . 2005/07/01
Fenthion 2005 7 2 . . . . 2005/08/01
Fenthion 2005 7 1 . . . . 2005/09/01
Fenthion 2005 1 1 . . . . 2005/10/01
Fenthion 2005 3 0 . . . . 2005/11/01
Fenthion 2005 4 0 . . . . 2005/12/01
Fenthion 2006 3 0 . . . . 2006/01/01
Fenthion 2006 2 0 . . . . 2006/02/01
Fenthion 2006 2 0 . . . . 2006/03/01
Fenthion 2006 5 1 . . . . 2006/04/01
Fenthion 2006 2 0 . . . . 2006/06/01
Fenthion 2006 5 0 . . . . 2006/07/01
Fenthion 2006 2 1 . . . . 2006/08/01
Fenthion 2006 5 1 . . . . 2006/09/01
Fenthion 2006 5 0 . . . . 2006/10/01
Fenthion 2006 2 0 . . . . 2006/11/01
Fenthion 2006 3 0 . . . . 2006/12/01
Fenthion 2007 6 1 . . . . 2007/01/01
Fenthion 2007 4 1 . . . . 2007/02/01
Fenthion 2007 2 0 . . . . 2007/03/01
Fenthion 2007 4 1 . . . . 2007/04/01
Fenthion 2007 3 1 . . . . 2007/06/01
Fenthion 2007 2 0 . . . . 2007/07/01
Fenthion 2007 3 0 . . . . 2007/08/01
Fenthion 2007 5 2 . . . . 2007/09/01
Fenthion 2007 4 1 . . . . 2007/10/01
Fenthion 2007 1 1 . . . . 2007/11/01
Fenthion 2007 3 0 . . . . 2007/12/01
Fenthion 2008 2 0 . . . . 2008/01/01
Fenthion 2008 3 0 . . . . 2008/03/01
Fenthion 2008 2 0 . . . . 2008/04/01
Fenthion 2008 3 1 . . . . 2008/05/01
Fenthion 2008 1 0 . . . . 2008/06/01
Fenthion 2008 2 1 . . . . 2008/07/01
Fenthion 2008 3 1 . . . . 2008/08/01
Fenthion 2008 3 1 . . . . 2008/09/01
Fenthion 2008 1 0 . . . . 2008/11/01
Fenthion 2008 2 0 . . . . 2008/12/01
Fenthion 2009 2 0 . . . . 2009/01/01
Fenthion 2009 2 1 . . . . 2009/02/01
Fenthion 2009 3 1 . . . . 2009/03/01
Fenthion 2009 1 1 . . . . 2009/04/01
Fenthion 2009 5 1 . . . . 2009/05/01
Fenthion 2009 1 0 . . . . 2009/06/01
Fenthion 2009 3 0 . . . . 2009/07/01
Fenthion 2009 2 1 . . . . 2009/09/01
Fenthion 2009 4 2 . . . . 2009/10/01
Fenthion 2009 2 0 . . . . 2009/11/01
Fenthion 2009 2 1 . . . . 2009/12/01
Fenthion 2010 1 1 . . . . 2010/01/01
Fenthion 2010 3 1 . . . . 2010/02/01
Fenthion 2010 4 0 . . . . 2010/04/01
Fenthion 2010 1 0 . . . . 2010/06/01
Fenthion 2010 2 1 . . . . 2010/07/01
Fenthion 2010 2 0 . . . . 2010/08/01
Fenthion 2010 1 0 . . . . 2010/10/01
Fenthion 2010 1 0 . . . . 2010/11/01
Fenthion 2011 . . 1 0 . . 2011/01/01
Fenthion 2011 . . 3 1 . . 2011/04/01
Fenthion 2011 . . 1 0 . . 2011/05/01
Fenthion 2011 . . 1 0 . . 2011/09/01
Fenthion 2011 . . 1 0 . . 2011/10/01
Fenthion 2012 . . . . 2 0 2012/01/01
Fenthion 2012 . . . . 1 0 2012/10/01
Fenthion 2012 . . . . 1 0 2012/12/01
Fenthion 2013 . . . . 1 0 2013/05/01
Fenthion 2018 . . . . 1 0 2018/01/01
Paraquat 2002 6 1 . . . . 2002/05/01
Paraquat 2002 10 4 . . . . 2002/06/01
Paraquat 2002 6 4 . . . . 2002/07/01
Paraquat 2002 4 3 . . . . 2002/08/01
Paraquat 2002 9 5 . . . . 2002/09/01
Paraquat 2002 7 3 . . . . 2002/10/01
Paraquat 2002 14 8 . . . . 2002/11/01
Paraquat 2002 10 7 . . . . 2002/12/01
Paraquat 2003 17 10 . . . . 2003/01/01
Paraquat 2003 3 2 . . . . 2003/02/01
Paraquat 2003 2 1 . . . . 2003/03/01
Paraquat 2003 3 3 . . . . 2003/06/01
Paraquat 2003 1 1 . . . . 2003/07/01
Paraquat 2003 5 5 . . . . 2003/08/01
Paraquat 2003 8 5 . . . . 2003/09/01
Paraquat 2003 4 4 . . . . 2003/10/01
Paraquat 2003 8 5 . . . . 2003/11/01
Paraquat 2003 2 1 . . . . 2003/12/01
Paraquat 2004 6 3 . . . . 2004/01/01
Paraquat 2004 4 2 . . . . 2004/02/01
Paraquat 2004 9 5 . . . . 2004/03/01
Paraquat 2004 12 7 . . . . 2004/04/01
Paraquat 2004 3 1 . . . . 2004/05/01
Paraquat 2004 11 8 . . . . 2004/06/01
Paraquat 2004 10 5 . . . . 2004/07/01
Paraquat 2004 3 1 . . . . 2004/08/01
Paraquat 2004 5 2 . . . . 2004/09/01
Paraquat 2004 6 3 . . . . 2004/10/01
Paraquat 2004 14 10 . . . . 2004/11/01
Paraquat 2004 9 3 . . . . 2004/12/01
Paraquat 2005 3 2 . . . . 2005/01/01
Paraquat 2005 6 2 . . . . 2005/02/01
Paraquat 2005 8 4 . . . . 2005/03/01
Paraquat 2005 10 5 . . . . 2005/04/01
Paraquat 2005 13 4 . . . . 2005/05/01
Paraquat 2005 8 3 . . . . 2005/06/01
Paraquat 2005 7 3 . . . . 2005/07/01
Paraquat 2005 7 2 . . . . 2005/08/01
Paraquat 2005 4 2 . . . . 2005/09/01
Paraquat 2005 9 6 . . . . 2005/10/01
Paraquat 2005 13 3 . . . . 2005/11/01
Paraquat 2005 13 5 . . . . 2005/12/01
Paraquat 2006 8 3 . . . . 2006/01/01
Paraquat 2006 5 2 . . . . 2006/02/01
Paraquat 2006 10 4 . . . . 2006/03/01
Paraquat 2006 12 4 . . . . 2006/04/01
Paraquat 2006 13 6 . . . . 2006/05/01
Paraquat 2006 8 3 . . . . 2006/06/01
Paraquat 2006 8 3 . . . . 2006/07/01
Paraquat 2006 2 2 . . . . 2006/08/01
Paraquat 2006 7 2 . . . . 2006/09/01
Paraquat 2006 7 2 . . . . 2006/10/01
Paraquat 2006 11 4 . . . . 2006/11/01
Paraquat 2006 18 12 . . . . 2006/12/01
Paraquat 2007 18 8 . . . . 2007/01/01
Paraquat 2007 21 7 . . . . 2007/02/01
Paraquat 2007 21 8 . . . . 2007/03/01
Paraquat 2007 19 11 . . . . 2007/04/01
Paraquat 2007 19 11 . . . . 2007/05/01
Paraquat 2007 17 7 . . . . 2007/06/01
Paraquat 2007 11 4 . . . . 2007/07/01
Paraquat 2007 19 12 . . . . 2007/08/01
Paraquat 2007 18 8 . . . . 2007/09/01
Paraquat 2007 12 6 . . . . 2007/10/01
Paraquat 2007 25 15 . . . . 2007/11/01
Paraquat 2007 20 10 . . . . 2007/12/01
Paraquat 2008 15 5 . . . . 2008/01/01
Paraquat 2008 13 6 . . . . 2008/02/01
Paraquat 2008 17 5 . . . . 2008/03/01
Paraquat 2008 14 4 . . . . 2008/04/01
Paraquat 2008 29 13 . . . . 2008/05/01
Paraquat 2008 18 2 . . . . 2008/06/01
Paraquat 2008 12 1 . . . . 2008/07/01
Paraquat 2008 7 3 . . . . 2008/08/01
Paraquat 2008 9 3 . . . . 2008/09/01
Paraquat 2008 20 7 . . . . 2008/10/01
Paraquat 2008 14 10 . . . . 2008/11/01
Paraquat 2008 14 3 . . . . 2008/12/01
Paraquat 2009 20 9 . . . . 2009/01/01
Paraquat 2009 7 3 . . . . 2009/02/01
Paraquat 2009 10 2 . . . . 2009/03/01
Paraquat 2009 14 4 . . . . 2009/04/01
Paraquat 2009 18 5 . . . . 2009/05/01
Paraquat 2009 10 3 . . . . 2009/06/01
Paraquat 2009 14 5 . . . . 2009/07/01
Paraquat 2009 15 6 . . . . 2009/08/01
Paraquat 2009 10 3 . . . . 2009/09/01
Paraquat 2009 20 8 . . . . 2009/10/01
Paraquat 2009 13 4 . . . . 2009/11/01
Paraquat 2009 8 3 . . . . 2009/12/01
Paraquat 2010 8 4 . . . . 2010/01/01
Paraquat 2010 13 8 . . . . 2010/02/01
Paraquat 2010 12 5 . . . . 2010/03/01
Paraquat 2010 14 9 . . . . 2010/04/01
Paraquat 2010 12 10 . . . . 2010/05/01
Paraquat 2010 13 4 . . . . 2010/06/01
Paraquat 2010 6 5 . . . . 2010/07/01
Paraquat 2010 14 5 . . . . 2010/08/01
Paraquat 2010 6 4 . . . . 2010/09/01
Paraquat 2010 15 8 . . . . 2010/10/01
Paraquat 2010 7 1 . . . . 2010/11/01
Paraquat 2010 8 4 . . . . 2010/12/01
Paraquat 2011 . . 7 3 . . 2011/01/01
Paraquat 2011 . . 10 2 . . 2011/02/01
Paraquat 2011 . . 12 4 . . 2011/03/01
Paraquat 2011 . . 13 5 . . 2011/04/01
Paraquat 2011 . . 17 2 . . 2011/05/01
Paraquat 2011 . . 15 2 . . 2011/06/01
Paraquat 2011 . . 13 1 . . 2011/07/01
Paraquat 2011 . . 5 1 . . 2011/08/01
Paraquat 2011 . . 10 3 . . 2011/09/01
Paraquat 2011 . . 12 4 . . 2011/10/01
Paraquat 2011 . . 8 1 . . 2011/11/01
Paraquat 2011 . . 13 4 . . 2011/12/01
Paraquat 2012 . . . . 12 4 2012/01/01
Paraquat 2012 . . . . 10 7 2012/02/01
Paraquat 2012 . . . . 9 2 2012/03/01
Paraquat 2012 . . . . 3 3 2012/04/01
Paraquat 2012 . . . . 2 0 2012/05/01
Paraquat 2012 . . . . 8 2 2012/06/01
Paraquat 2012 . . . . 7 2 2012/07/01
Paraquat 2012 . . . . 2 1 2012/08/01
Paraquat 2012 . . . . 4 0 2012/09/01
Paraquat 2012 . . . . 7 1 2012/10/01
Paraquat 2012 . . . . 7 2 2012/11/01
Paraquat 2012 . . . . 2 1 2012/12/01
Paraquat 2013 . . . . 3 0 2013/01/01
Paraquat 2013 . . . . 5 1 2013/02/01
Paraquat 2013 . . . . 3 0 2013/03/01
Paraquat 2013 . . . . 3 2 2013/04/01
Paraquat 2013 . . . . 1 0 2013/06/01
Paraquat 2013 . . . . 5 1 2013/07/01
Paraquat 2013 . . . . 3 2 2013/08/01
Paraquat 2013 . . . . 3 1 2013/09/01
Paraquat 2013 . . . . 4 2 2013/10/01
Paraquat 2013 . . . . 2 0 2013/11/01
Paraquat 2013 . . . . 3 0 2013/12/01
Paraquat 2014 . . . . 3 1 2014/01/01
Paraquat 2014 . . . . 2 1 2014/02/01
Paraquat 2014 . . . . 1 0 2014/03/01
Paraquat 2014 . . . . 2 0 2014/04/01
Paraquat 2014 . . . . 1 0 2014/05/01
Paraquat 2014 . . . . 3 0 2014/06/01
Paraquat 2014 . . . . 3 1 2014/07/01
Paraquat 2014 . . . . 1 0 2014/08/01
Paraquat 2014 . . . . 2 0 2014/09/01
Paraquat 2014 . . . . 1 0 2014/10/01
Paraquat 2014 . . . . 1 1 2014/11/01
Paraquat 2014 . . . . 1 1 2014/12/01
Paraquat 2015 . . . . 1 0 2015/01/01
Paraquat 2015 . . . . 1 0 2015/03/01
Paraquat 2015 . . . . 1 0 2015/11/01
Paraquat 2015 . . . . 2 0 2015/12/01
Paraquat 2016 . . . . 1 0 2016/01/01
Paraquat 2016 . . . . 1 0 2016/02/01
Paraquat 2016 . . . . 2 1 2016/05/01
Paraquat 2016 . . . . 2 0 2016/06/01
Paraquat 2018 . . . . 1 1 2018/12/01
;
run;
options nobyline;
proc sgplot data=test noautolegend;
yaxis label="Poisoning Cases";
y2axis label="Deaths" integer;
xaxis label="Year/Month" values=('1MAR2002'd to '1APR2019'd by month);
reg x=PlotDate y=NPoisonings_pre /lineattrs=(pattern=2) markerattrs=(symbol=circle) ;
reg x=PlotDate y=NPoisonings_post /lineattrs=(pattern=3) markerattrs=(symbol=circle) ;
reg x=PlotDate y=NDeaths_pre /lineattrs=(pattern=4) markerattrs=(symbol=plus) y2axis ;
reg x=PlotDate y=NDeaths_post /lineattrs=(pattern=5) markerattrs=(symbol=plus) y2axis ;
scatter x=PlotDate y=NPoisonings_int / markerattrs=(symbol=circle) ;
scatter x=PlotDate y=NDeaths_int / markerattrs=(symbol=plus) y2axis ;
band y=NPoisonings_pre lower='1JAN2011'd upper='1DEC2011'd /transparency=0.6 ;
title '#byval(Substance)';
by Substance;
run;
options byline;

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

The VALUES option is defeating the standard time axis splitting. Instead of using the VALUES option here, use the INTERVAL option to set your time intervals. For the amount of data you have, INTERVAL=MONTH will probably be too crowded. You can try something like INTERVAL=SEMIYEAR.

 

Hope this helps!

Dan

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

The VALUES option is defeating the standard time axis splitting. Instead of using the VALUES option here, use the INTERVAL option to set your time intervals. For the amount of data you have, INTERVAL=MONTH will probably be too crowded. You can try something like INTERVAL=SEMIYEAR.

 

Hope this helps!

Dan

JacquesR
Quartz | Level 8

Thanks, that has helped me get the two-line axis values.
INTERVAL=Month is, as you pointed out, too crowded, INTERVAL=year actually works quite well, but is a bit sparse on the information I feel I need, and INTERVAL=semiyear give me year and Jan only, essentially adding no additional information.

So in the end, I have two lines, but still not quite what I wanted.

Interestingly, despite the help files stating, under the VALUES section: 

"Tip: Use the VALUESDISPLAY= option to specify string replacement text for the specified values."

When I use 

VALUES =("01mar02"d to "01apr18"d by month)

VALUESDISPLAY=("2002" "" "" "" "" "" "" "" "" "" "2003" "" "" "" "" "" "" "" "" "" "" "" "2004" "" "" "" "" "" "" "" "" "" "" "" "2005" "" "" "" "" "" "" "" "" "" "" "" "2006" "" "" "" "" "" "" "" "" "" "" "" "2007" "" "" "" "" "" "" "" "" "" "" "" "2008" "" "" "" "" "" "" "" "" "" "" "" "2009" "" "" "" "" "" "" "" "" "" "" "" "2010" "" "" "" "" "" "" "" "" "" "" "" "2011" "" "" "" "" "" "" "" "" "" "" "" "2012" "" "" "" "" "" "" "" "" "" "" "" "2013" "" "" "" "" "" "" "" "" "" "" "" "2014" "" "" "" "" "" "" "" "" "" "" "" "2015" "" "" "" "" "" "" "" "" "" "" "" "2016" "" "" "" "" "" "" "" "" "" "" "" "2017" "" "" "" "" "" "" "" "" "" "" "" "2018" "" "" "" "" "" "" "" "" "" "" "" "2019" "" "" "")

[which should give me the same output as INTERVAL=YEAR], I don't get the requested tick mark labels (instead: 2002-03, 2003-12, 2005-09, 2007-06, etc).

When I remove the format PlotDate YYMMD.; statement, it starts to work, but still not quite as I would want or expect.

I suppose if I started playing with the font size on the axis, I might get SAS to fit more in?

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 446 views
  • 0 likes
  • 2 in conversation