楼主: pinggu2688
8844 10

[原创博文] SAS如何绘制矢量图 [推广有奖]

  • 2关注
  • 0粉丝

博士生

6%

还不是VIP/贵宾

-

威望
0
论坛币
40 个
通用积分
40.2335
学术水平
1 点
热心指数
3 点
信用等级
1 点
经验
3113 点
帖子
166
精华
0
在线时间
103 小时
注册时间
2009-11-12
最后登录
2024-8-28

楼主
pinggu2688 发表于 2011-7-21 01:55:21 |AI写论文
50论坛币
sas绘制的位图比如gif,jpg格式,放大后变得不清楚,请问如何绘制矢量图,任意放大后都不失真?
比如用proc gplot绘制散点图。请详细说明,满意则马上选为最佳答案。多谢。另外补充问,SAS如果是9.0版本或者9.2版本如何分别解决。
多谢

最佳答案

lutian08 查看完整内容

filename g_out "e:\xu.cgm"; goptions reset=all gunit=pct htext=2.5 ftext="simplex" hsize=16.5cm vsize=16.5cm device=cgm gsfname=g_out noborder; 这是我曾经用过的一段程序,输出的是矢量图。SAS 9.0版本或者9.2版本都可以 应该能解决你的问题
关键词:矢量图 gplot plot 详细说明 最佳答案 矢量图 散点图 如何

本帖被以下文库推荐

沙发
lutian08 发表于 2011-7-21 01:55:22
filename g_out "e:\xu.cgm";
goptions reset=all gunit=pct htext=2.5 ftext="simplex" hsize=16.5cm vsize=16.5cm device=cgm  gsfname=g_out noborder;

这是我曾经用过的一段程序,输出的是矢量图。SAS 9.0版本或者9.2版本都可以
应该能解决你的问题
已有 2 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
pinggu2688 + 1 + 1 + 1 备注:plot2pdf 1.40可以打开cgm文件并且可以转换成pdf
liuzhenzhu + 20 + 1 + 2 热心帮助其他会员

总评分: 论坛币 + 20  学术水平 + 2  热心指数 + 3  信用等级 + 1   查看全部评分

藤椅
lutian08 发表于 2011-7-21 03:11:36
可以输出用emf格式的

板凳
leedx 发表于 2011-7-21 11:39:05
学习了,呵呵,谢谢~~~

报纸
yugao1986 发表于 2011-7-21 11:42:10
以下内容摘自:http://support.sas.com/kb/37/261.html,希望对楼主有用。
This sample SAS code demonstrates two methods for creating SVG output.
  1. /* This sample program uses the SVG SAS/GRAPH */
  2. /* device driver with the ODS HTML statement. */
  3. /* This sample code demonstrates how to create */
  4. /* scalable vector graphics output that */
  5. /* provides pop-up tool tips along with drill */
  6. /* down capability. */

  7. filename odsout 'c:\temp';
  8. %let textcolor=gray66;

  9. proc format;
  10. value measfmt
  11. 1='Satisfaction with\SAS software'
  12. 2='Satisfaction with\SAS relationship'
  13. 3='Likely to\recommend renewal';
  14. run;

  15. data mydat;
  16. format Satisfaction percent7.0;
  17. format Measure measfmt.;
  18. input Measure Training $ 3-19 Satisfaction;
  19. cards;
  20. 1 Attended Training .93
  21. 1 No Training .86
  22. 2 Attended Training .85
  23. 2 No Training .76
  24. 3 Attended Training .92
  25. 3 No Training .84
  26. ;
  27. run;

  28. data my_data;
  29. set mydat;
  30. length myhtml $ 1024;
  31. myhtml='title='|| quote( trim(left(put(measure,measfmt.))) || '0d'x
  32. || 'Statisfaction: ' || trim(left(put(satisfaction,percent7.0)))||' ')
  33. || 'href="http://sww.sas.com/"';
  34. run;

  35. goptions reset=goptions device=svg;

  36. ods listing close;
  37. ods html path=odsout body="svgsample1.htm" (title="SAS Customer Satisfaction & Training");
  38. goptions noborder;

  39. goptions gunit=pct htext=3.1 ctext=&textcolor ftext="Thorndale AMT/bold";
  40. goptions cback=white;

  41. axis1 c=graycc label=none value=none;
  42. axis2 c=graycc label=none value=(c=&textcolor) order=(.60 to .95 by .05) minor=none offset=(0,0);
  43. axis3 c=graycc label=none value=(c=&textcolor height=3) split='\' offset=(7,5);

  44. legend1 position=(middle right) mode=share shape=bar(.12in,.12in) across=1 label=none offset=(1,28);

  45. pattern1 value=solid color=cx1b3f8b;
  46. pattern2 value=solid color=cxcd0000;

  47. title1 h=10 " ";
  48. title2 j=left c=gray55 f="Thorndale AMT/bold" h=6 " Training Drives Satisfaction & Loyalty";
  49. title3 j=left ls=1.1 " Creating Opportunity for New Sales";
  50. title4 h=4 " ";
  51. title5 a=-90 h=3 " ";

  52. footnote1 h=3 " ";
  53. footnote2 j=left " ** Training customers happier in all 31 measures";
  54. footnote3 h=2 " ";

  55. proc gchart data=my_data;
  56. vbar3d Training / discrete
  57. type=sum sumvar=Satisfaction
  58. outside=sum
  59. group=Measure
  60. cframe=white
  61. space=0
  62. width=10
  63. gspace=15
  64. subgroup=Training
  65. maxis=axis1
  66. raxis=axis2
  67. gaxis=axis3
  68. coutline=same
  69. legend=legend1
  70. noframe
  71. html=myhtml
  72. des="";
  73. run;
  74. quit;

  75. axis4 c=graycc label=none value=(c=&textcolor) order=(0 to 1.00 by .20) minor=none offset=(0,0);
  76. legend2 position=(middle right) mode=share shape=bar(.12in,.12in) across=1 label=none offset=(1,31);

  77. proc gchart data=my_data;
  78. vbar3d Training / discrete
  79. type=sum sumvar=Satisfaction
  80. outside=sum
  81. group=Measure
  82. cframe=white
  83. space=0
  84. width=10
  85. gspace=15
  86. subgroup=Training
  87. maxis=axis1
  88. raxis=axis4
  89. gaxis=axis3
  90. coutline=same
  91. legend=legend2
  92. noframe
  93. des="";
  94. run;
  95. quit;

  96. proc gchart data=my_data;
  97. vbar Training / discrete
  98. type=sum sumvar=Satisfaction
  99. outside=sum
  100. group=Measure
  101. cframe=white
  102. space=0
  103. width=10
  104. gspace=15
  105. subgroup=Training
  106. maxis=axis1
  107. raxis=axis4
  108. gaxis=axis3
  109. coutline=graycc
  110. legend=legend2
  111. noframe
  112. des="";
  113. run;
  114. quit;

  115. ods html close;
  116. ods listing;


  117. /* This sample program uses the PRINTERPATH=SVGT */
  118. /* system option together with the ODS PRINTER */
  119. /* statement. The SVGT printer is used to create */
  120. /* output with no background, producing a */
  121. /* transparent effect. Each page in the document */
  122. /* is overlaid. This allows you to see through */
  123. /* to all pages in the document. This is an */
  124. /* example of overlaying a bar chart with a */
  125. /* transparent background onto a map with the */
  126. /* SVGT printer. This allows the map area behind */
  127. /* the bar chart to be visible. */

  128. data boxanno;
  129. length function color style $20 text $16;
  130. retain xsys ysys '2' hsys '3' when 'a';
  131. set maps.uscity(keep=x y city state);
  132. where city='Raleigh' and state=stfips('NC');
  133. color='blue'; size=4; text='V'; position='5'; style='marker'; output;
  134. myx=x;
  135. myy=y;
  136. function='move';
  137. x=myx; y=myy; output;
  138. function='draw';
  139. x=myx-.432; y=myy+.0417; color='gray'; line=1; size=.2; style='solid'; output;
  140. function='move';
  141. x=myx; y=myy; output;
  142. function='draw';
  143. x=myx-.432; y=myy+.178; output;
  144. function='move';
  145. x=myx; y=myy; output;
  146. function='draw';
  147. x=myx-.251; y=myy+.178; output;
  148. function='move';
  149. x=myx; y=myy; output;
  150. function='draw';
  151. x=myx-.251; y=myy+.0417; output;
  152. run;

  153. %let name=annomap;

  154. goptions reset=all border gunit=pct htitle=5 htext=3
  155. ftext="arial/bo";

  156. options printerpath=svgt nodate nonumber;

  157. ods listing close;
  158. ods printer file='c:\temp\annomap.svg' ;

  159. pattern1 v=s c=cornsilk;

  160. title1 c=red "SAS/Graph gmap and overlayed gchart with printerpath=svgt";

  161. proc gmap data=maps.us map=maps.us ;
  162. id state;
  163. choro state / levels=1 nolegend coutline=blue anno=boxanno
  164. des="" name="&name";
  165. run;
  166. quit;

  167. goptions hsize=2.07 vsize=1.57 horigin=2.1
  168. vorigin=3.12 autosize=on device=svgt;

  169. /* You must use the default ODS style for transparency to work */

  170. goptions gunit=pct htext=12 ftext="Albany AMT" ;

  171. title 'Transparent SVG';
  172. pattern1 v=s c=red;
  173. axis1 label=none value=none major=none minor=none style=0;
  174. axis2 color=blue label=none offset=(7,7) value=(color=blue);

  175. proc gchart data=sashelp.class;
  176. vbar3d age / discrete descending raxis=axis1 maxis=axis2 width=9 space=5
  177. frame autoref coutline=blue woutline=1
  178. des="" name="&name.b";
  179. run;
  180. quit;

  181. ods printer close;
  182. ods listing;
复制代码
三人行必有我师

地板
lutian08 发表于 2011-7-23 03:23:02
楼主那 50 个论坛币 给谁了?

7
pinggu2688 发表于 2011-7-23 12:30:35
cgm用什么打开阿

8
yugao1986 发表于 2011-7-23 12:48:48
svg格式图形,利用插件Adobe SVG Viewer,浏览器打开
三人行必有我师

9
lutian08 发表于 2011-7-23 22:13:26
7# pinggu2688
可以插入到word中

10
zkymath 在职认证  发表于 2011-8-4 16:10:18
lutian08 发表于 2011-7-21 03:11
可以输出用emf格式的
是啊,然后再emf2eps就好了

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-9 12:42