Data visualization with SAS programming

stock charts with missing data

Reply
SAS Employee
Posts: 2

stock charts with missing data

If I graph daily stock prices following this example http://support.sas.com/kb/35/169.html (which is monthly data, despite the title on the chart), there are gaps caused by weekend days and other days with no data. Can I tell PROC SGPLOT to ignore the missing data while still using SERIES plots with XAXIS TYPE=TIME?  (I'm at 9.3).

Thanks!

SAS Super FREQ
Posts: 925

stock charts with missing data

When you say, "ignore", do you want the series line to be connected through the missing days or do you want the line to break at the missing days? If you want the line to break, you can use the BREAK option on the SERIES plot.

As an aside, because you have SAS 9.3, you can now do that stock example using a true HighLow plot.

Hope this helps,

Dan

SAS Employee
Posts: 2

stock charts with missing data

I don't want gaps between the bars.  I figure I could set TYPE=DISCRETE, but then I lose some of the niceties that go along with a defined time axis.

P.S. I noticed HighLow in the doc yesterday, actually.  Will give it a try.   

SAS Super FREQ
Posts: 1,138

Re: stock charts with missing data

If the x values are real sas date values, data is plotted in its correct scaled location, so you will get the gaps when stock exchange is closed.  If you make the X axis discrete, each value will be plotted individually with equal spacing.  But you will lose the date formatting for the x axis, and each tick value will be shown.  This is true for HighLow plot too.

If the missing values are to be "compressed" out of the x-axis, the x-axis is no longer on a continuous linear scale.  It is not clear how this should be done.  Maybe you could use a COLUMNLATTICE where the days are classified by their week name to get what you need.  You can suppress the cell borders, etc.

Super User
Posts: 11,107

Re: stock charts with missing data

If available to you, PROC GPLOT using a creative AXIS statement listing values of the days with data might work. You would get a warning in the log about non-uniform values on your ticks but might accomplish what you want.

Ask a Question
Discussion stats
  • 4 replies
  • 306 views
  • 0 likes
  • 4 in conversation