%let name=dow; filename odsout '.'; /* Got this data from ... http://finance.yahoo.com/ Clicked on 'dow' along left-hand side. http://finance.yahoo.com/q?d=t&s=^DJI Clicked on 'Historical Prices' along left-hand side. Selected Jan 2, 2000 - Dec 31, 2005 daily Clicked 'download to spreadsheet' at bottom of page. http://ichart.yahoo.com/table.csv?s=^DJI&a=00&b=2&c=2000&d=11&e=31&f=2005&g=d&ignore=.csv Saved as dow.csv This created data like ... Date,Open,High,Low,Close,Volume,Adj. Close* 29-Jul-04,10115.52,10213.08,10049.74,10129.24,15301000,10129.24 28-Jul-04,10084.03,10170.31,9966.34,10117.07,15543000,10117.07 27-Jul-04,9963.54,10133.95,9942.75,10085.14,16108000,10085.14 and so on... (* = Close price adjusted for dividends and splits. *) I've set up this program to use a 'url' filename, such that it will read the data directly from the website every time the sas job is run. If that website "goes away", or you want to run the program in a way that it doesn't need to go to the network, you can use the 'dow.csv' that I saved, instead. ----------------------------------------------------------------------*/ filename dowfile 'dow.csv'; /* The web version has gone away, so I'm using the copy I saved */ /* filename dowfile url "http://ichart.yahoo.com/table.csv?s=^DJI&a=00&b=2&c=2000&d=11&e=31&f=2005&g=d&ignore=.csv" proxy='http://inetgw.fyi.sas.com:80'; */ data dowdata; length datestr $9.; format date date7.; format close comma8.0; /* skip the first line (firstobs=2), since it's vbl names, and let it fail on the last line, since it's not data. Read in the date as a string, and then transform it into a date value sas can understand. */ infile dowfile dlm=',' firstobs=2; input datestr Open High Low Close Volume adjclose; date=input(compress(translate(datestr,'','-')),date7.); year=year(date); length html1 $1024; html1= 'title='||quote( 'Date: '||trim(left(put(date,date7.)))||'0d'x|| 'Close: '||trim(left(close))||'0d'x|| 'High: '||trim(left(high))||'0d'x|| 'Low: '||trim(left(low))||' ') ; run; proc sort data=dowdata out=dowdata; by date; run; goptions reset=global; GOPTIONS DEVICE=png; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Plot of DOW daily data") style=minimal gtitle gfootnote ; goptions noborder; goptions ftitle="arial" ftext="arial" htitle=6pct htext=3.5pct; axis1 label=none minor=none offset=(0,0); axis2 label=none minor=none offset=(0,0); goptions colors=(black blue red purple green orange); symbol v=dot i=join h=.3 r=10; title "DOW Jones Industrial Average"; title2 'Riding the "Wild Bull"!'; footnote j=l c=gray h=3pct "Data from " link="http://finance.yahoo.com/" "http://finance.yahoo.com/" /* Per the rules of using this image for free, we must include a link to their website. */ link="" j=r c=gray h=3pct "Bull Image from " link="http://www.clipart.co.uk" "http://www.clipart.co.uk"; proc gplot data=dowdata; plot close*date=year / vzero vaxis=axisw1 vref=2000 4000 6000 8000 10000 cvref=gray lvref=2 haxis=axis2 nolegend autohref chref=gray /* Got this image from http://www.clipart.co.uk/html/drawshop.shtml */ iframe='bullride.gif' imagestyle=fit html=html1 des="" name="&name"; run; /* proc print data=dowdata; run; */ quit; ODS HTML CLOSE; ODS LISTING;