主要的问题是程序不能实现数据量和图形字符大小的匹配问题,两者动其一,第二个就要求调试去匹配,才能很好的展示。
整体有点粗略,高手可以改进。
- data StockData;
- input Datetemp yymmdd10. Open High Low Close Volume;
- format Datetemp yymmdd10.;
- cards;
- 2006-2-6 1013.42 1033.35 1012.81 1033.23 25038771
- 2006-2-7 1034.68 1038.5 1019.94 1029.94 32954787
- 2006-2-8 1028.44 1033.4 1022.94 1033.07 26986729
- 2006-2-9 1033.19 1033.19 1017.05 1019.6 23839601
- 2006-2-10 1019.42 1032.6 1018.48 1032.34 22024453
- 2006-2-13 1034.38 1034.64 1021.84 1031.61 22157298
- 2006-2-14 1032.65 1038.81 1030.46 1038.53 18556220
- 2006-2-15 1040.33 1048.34 1038.74 1041.66 24784628
- 2006-2-16 1041.67 1041.67 1019.21 1020.12 26159892
- 2006-2-17 1020.06 1028.57 1015.99 1020.37 21026875
- 2006-2-20 1020.74 1030.05 1020.02 1021.64 18818883
- 2006-2-21 1020.98 1038.94 1014.66 1038.82 23678039
- 2006-2-22 1039.65 1046.45 1036.38 1037.89 25380704
- 2006-2-23 1038.25 1041.59 1029.25 1041.37 19785037
- 2006-2-24 1041.97 1049.69 1041.97 1049.44 19676104
- 2006-2-27 1055.95 1057.22 1045.97 1047.84 22872099
- 2006-2-28 1046.71 1053.72 1033.66 1053.01 19353267
- 2006-3-1 1051.76 1057.69 1049.64 1056.62 19425730
- 2006-3-2 1055.86 1056.05 1034.68 1038.67 24877861
- 2006-3-3 1037.99 1043.42 1029.56 1041.68 21200539
- 2006-3-6 1041.66 1044.42 1036.11 1038.87 17870963
- 2006-3-7 1037.93 1037.98 1013.14 1014.97 19336516
- 2006-3-8 1012.58 1014.97 999.93 1009.27 17463055
- 2006-3-9 1006.97 1010.91 1002.2 1004.34 12735099
- 2006-3-10 1004.75 1011.76 1004.69 1008.9 11887983
- 2006-3-13 1008.8 1020.88 1008.51 1019.86 11765911
- 2006-3-14 1020.47 1021.65 1012.11 1018.27 11348030
- 2006-3-15 1018.15 1028.96 1017.08 1028.96 14842068
- 2006-3-16 1028.96 1029.81 1025.52 1027.62 14784339
- 2006-3-17 1027.64 1029.56 1021.08 1024.02 15001924
- 2006-3-20 1024.5 1037.91 1019.65 1037.66 15389912
- 2006-3-21 1037.95 1047.05 1036.23 1040.76 19077662
- 2006-3-22 1041.141 1047.941 1036.71 1047.671 18640575
- 2006-3-23 1047.351 1049.321 1042.821 1048.541 20467885
- 2006-3-24 1049.12 1051.76 1041.23 1042.6 20098237
- 2006-3-27 1042.63 1050.71 1037.08 1050.71 17134070
- 2006-3-28 1050.07 1056.52 1048.64 1055.98 22273999
- 2006-3-29 1058.74 1074.041 1057.68 1065.291 30526345
- 2006-3-30 1065.841 1067.991 1055.141 1055.631 22012494
- 2006-3-31 1053.851 1061.471 1050.221 1061.091 22276190
- ;
- run;
- data CandleData;
- set StockData;
- if Open<Close then do;
- Date=Datetemp; y1=Open; output;
- Date=Datetemp; y1=High; output;
- Date=Datetemp; y1=Low; output;
- Date=Datetemp; y1=Close; output;
- Date=Datetemp; v1=Volume; output;
- end;
- if Open>=Close then do;
- Date=Datetemp; y2=Open; output;
- Date=Datetemp; y2=High; output;
- Date=Datetemp; y2=Low; output;
- Date=Datetemp; y2=Close; output;
- Date=Datetemp; v2=Volume; output;
- end;
- format Date yymmdd10.;
- run;
- goptions htitle=2 htext=1.5 ;
- goptions reset=global gunit=pct cback=black border ftext=swissb ;
- axis1 label=("Date") color=red;
- axis2 label=("Price") color=red;
- axis3 label=("Volume") color=red;
- ;
- proc gplot data=CandleData ;
- plot v1*Date=1 v2*Date=2/ overlay vaxis=axis3 haxis=axis1 des = "" name = "volume1";
- symbol1 c=red i=needle;
- symbol2 c=green i=needle;
- run;
- quit;
- proc gplot data=CandleData;
- plot y1*Date=3 y2*Date=4 / overlay grid vaxis=axis2 haxis=axis1 des = "" name = "price1";
- symbol3 c=red i=candle;
- symbol4 c=green i=candle;
- title "IF300";
- run;
- quit;
- goptions display;
- goptions xpixels=1000 ypixels=500;
- goptions border;
-
- ODS LISTING CLOSE;
- ODS HTML path="D:\" body="Candle.html"
- (title="my test K figure") style=minimal;
- /* *** Now, put it all together onto one page, using proc greplay */
- %let greout=white;
- proc greplay tc=tempcat nofs igout=work.gseg;
- tdef dashbrd des='USAA Investment Dashboard'
- 1/llx =1 lly = 30
- ulx =1 uly = 100
- urx =100 ury = 100
- lrx =100 lry = 30
- 2/llx =1 lly = 1
- ulx =1 uly = 30
- urx =100 ury = 30
- lrx =100 lry = 1
- ;
- template = dashbrd;
- treplay
- 1:price1
- 2:volume1
- des='' name="IF300 Candel";
- run;
- quit;
- ODS HTML CLOSE;
- ODS LISTING;