全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2011-11-18 09:03:55
新安装sas ods被防火墙屏蔽。大家有没有建议?
京剧
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-21 23:11:19
* please label the variable first;
proc transpose data =graph out =graph_t;
  by crack;
   var Heavyplate Hulllate;
run;
ods graphics/width =8in height =4in;
proc sgplot;
   vbarparm category =crack response =col1/group =_label_ dataskin =pressed;
   yaxis grid values =(0.000 to 0.007 by 0.001) label =' ';
   xaxis display =(noticks) label =' ';
   keylegend /location =outside position =right title =' ';
run;
ods graphics/reset;

The above code is an illustration from a question. Some options are only limited to SAS 9.3.

JingJu vbar-b.bmp

附件列表
vbar plot_j.jpg

原图尺寸 95.67 KB

vbar plot_j.jpg

vbar plot_j.jpg

原图尺寸 90.31 KB

vbar plot_j.jpg

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-25 06:48:42

Share a code about a question.

https://bbs.pinggu.org/thread-1264027-1-1.html


JingJu



data
Original;
input publishday: yymmdd10. price@@; format publishday date9.;
cards;
2011-8-2 20 2011-8-3 15 2011-8-4 14 2011-8-6 21 2011-8-7 19
2011-8-8 17 2011-8-9 22 2011-8-10 21
;
data a;
do _n_ =1 by 1 until(Eof);
      set original end =Eof;
      minD =min(minD, publishday); maxD =max(maxD, publishday);
   end;
   length d 8 price_c $12; format d date9.; keep d price_c; rename d =publishday price_c =price;
   if not missing(minD) then do d =minD to maxD;
      call missing(price_c);
      do p =1 to nobs;
         set original  point =p nobs =nobs;
         if publishday >d and publishday <=d +3 then price_c =catx(' ', price_c, price);
      end;
      output;
   end;
   stop;
run;






二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-26 06:26:39
A SAS example code was modified by myslef to illustrate a customized FOREST plot from the question  in
https://bbs.pinggu.org/thread-1262816-1-1.html

JingJu
-------------------------------------------------------------------------
data meta(keep=Study Stat Value weight0)
    overall(keep=overall overallvalue)
     labels(keep=Study OddsRatio LowerCL UpperCl constant);
  input Study $1-16 OddsRatio LowerCL UpperCL Weight;
  weight0 =weight*10;
  length Stat $8;            
  format  OddsRatio LowerCL UpperCL 5.3;  
  output Labels;
  if Study eq "Overall" then do;
    OverallValue=OddsRatio;
    Overall="Overall";      
    output overall;
  end;
else do;
    weight=weight*.075;
    Stat="MIN";      
    Value=LowerCL;
    output meta;
    Stat="MAX";               
    Value=UpperCL;
    output meta;
    Stat="Q1";      
    Value= OddsRatio/(10 ** (weight/2));
    output meta;
    Stat="Q3";      
   Value= OddsRatio*(10 ** (weight/2));
    output meta;
    Stat="BOXWIDTH";
    Value=weight*3;
    output meta;
  end;
  datalines;
Modano  (1967)    0.590 0.096 3.634  1
Borodan (1981)    0.464 0.201 1.074  3.5
Leighton (1972)   0.394 0.076 2.055  2
Novak   (1992)    0.490 0.088 2.737  2
Stawer  (1998)    1.250 0.479 3.261  3
Truark   (2002)   0.129 0.027 0.605  2.5
Fayney   (2005)   0.313 0.054 1.805  2
Modano  (1969)    0.429 0.070 2.620  2
Soloway (2000)    0.718 0.237 2.179  3
Adams   (1999)    0.143 0.082 0.250  4
Truark2  (2002)   0.129 0.027 0.605  2.5
Fayney2  (2005)   0.313 0.054 1.805  2
Modano2 (1969)    0.429 0.070 2.620  2
Soloway2(2000)    0.718 0.237 2.179  3
Adams2   (1999)    0.143 0.082 0.250  4
Overall           0.328 0.233 0.462  .
;
run;



附件列表
forest.png

原图尺寸 129.5 KB

forest.png

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-26 06:28:18
cont on last post...

proc template;
define statgraph ForestPlot_2Col;
  dynamic _pct;
  begingraph / designwidth=600px designheight=400px;
  entrytitle "Impact of Treatment on Mortality" / pad=(bottom=.025px);
    layout overlay / walldisplay=(fill)
                   yaxisopts=(display=none reverse=true offsetmin=_pct offsetmax=_pct)
                   xaxisopts=(type=linear offsetmin=0 offsetmax=0 linearopts =(tickvaluelist =(0 1 2 4) viewmin=-5 viewmax=4)
                                   label="                                                                    odds ratios");
      entry halign=left "             Study" "         sample" "       OR"  "        95%CI" halign=right  " " / location=outside valign=top ;
      scatterplot y=Study x=eval(constant*4) / markercharacter=Study;
      scatterplot y=Study x=eval(constant*3) / markercharacter=weight0;
      scatterplot y=Study x=eval(constant*2) / markercharacter=OddsRatio;           
               scatterplot y=Study x=eval(constant*1) / markercharacter=CI95;
      boxplotparm x=Study y=value stat=stat / orient=horizontal display=(fill notches);
      scatterplot x=OverallValue y=overall / markerattrs=(color=orange symbol=diamondfilled size=4pct);
               referenceline x=1. / lineattrs=(pattern=solid);
      referenceline x=.0 / lineattrs=(pattern=shortdash);
    endlayout;
  endgraph;
  end;
run;


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-26 06:29:06
proc template;
define Style foreststyle;
parent = styles.analysis;
style GraphFonts from GraphFonts
"Fonts used in graph styles" /
'GraphTitleFont' = (", ",10pt,bold)
'GraphLabelFont' = (", ",8pt)
'GraphValueFont' = (", ",7pt)
'GraphDataFont' = (", ",7pt);
end;
run;
title;
options nodate nonumber;
ods listing close;
ods rtf;
ods graphics / reset;
proc sgrender data=forest template=ForestPlot_2Col;
dynamic _pct=&pct;
run;
ods _all_ close; ods listing;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-27 13:36:22
用9.2+ 9.1.3的路过
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-30 10:16:58
meta-analysis基本已经形成了自己比较完备的比较系统的理论和解决方案。不知道为什么sas没有做成一个过程,甚至一个集成的macro都没有?
京剧
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-12-1 01:45:09
An example of SAS BY-processing in model-fitting.
JingJu
---------------------------------------------------------------------------------------------------
/* Sort by plots variable in order to use BY statement in PROC*/
proc sort data =trees out =trees_s; by plots;
run;

******** FIT GENERALIZED NONLINEAR MIXED MODEL************* ;

proc nlmixed data=trees_s;
   by plots; *BY-processing =sub-setting the data set;
                 *BY-processing is enhanced by its efficiency;
   parms a=0.1 b=-0.002;                                                         
   eta = a + b*year;                                 
   p_ann_mort = exp(eta)/(1+exp(eta));                        
   p_ann_surv = 1-p_ann_mort;                                                
   p_surv = p_ann_surv**yr_interval;                                 
   p_mort = 1-p_surv;
   mean_mort = live_off*p_mort;
   ll=lgamma(1/alpha + n_dead) - lgamma(1 + n_dead) - lgamma(1/alpha)   + n_dead*log(alpha*mean_mort) - (1/alpha + n_dead)*log(1 + alpha*mean_mort);        
         * log likelihood function for negative binomial regression ;
   model n_dead ~ general(ll);
   predict live_off*p_mort out=predobs1;
   ods output ParameterEstimates =PEs; *create an output table PEs you needed;
run;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-12-1 07:24:43
Even though, SAS provided an excellent KM-plot in its procedure, the customized KM-plots from assorted users are still of painstaking. Here I present my code for one of those.
JingJu

ods output  ProductLimitEstimates =lifetest_PEs;
proc lifetest data =LifeTest0 atrisk outsurv =outSurv1  ;
time time_m*censored(1);
run;
ods output clear;
data outSurv11;
   merge outSurv1 LifeTest_PEs(keep =time_m numberatrisk);;
   by Time_m;
run;

km-plot.png
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-12-1 07:28:12
Continue…

复制代码




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-12-1 08:05:05
To get means from quantile-range data as that question. Of note, this code is not verified.
JingJu

proc sort data =had out =have; by sharp;
run;
data have2;
   keep Q1m Q3m;
   do p =1 to n;
      set have point =p nobs =n;
      if p <=ceil(1/4 *n) then Q1m ++(sharp -Q1m)/p;
         else if p >ceil(3/4 *n) then Q3m ++(sharp -Q3m)/(p -ceil(3/4 *n));
   end;
   output;
   stop;
run;





二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-12-1 15:06:00
SAS 9.3的ods rtf有问题,让我很郁闷。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-12-1 22:43:54
ademons 发表于 2011-12-1 15:06
SAS 9.3的ods rtf有问题,让我很郁闷。
我看了你的帖子。我觉得你没有清晰描述你的问题。京剧
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-12-2 18:03:56
    ademons 发表于 2011-12-1 15:06
    SAS 9.3的ods rtf有问题,让我很郁闷。

我看了你的帖子。我觉得你没有清晰描述你的问题。京剧
------------------------------------------------------
就是orientation=landscape的页面后面的 orientation=portrait 的页面非常窄。我设定了options papersize=A4,没有用。另外,ods rtf text=“string”与换页与横竖版转换这三者之间的关系我还没有搞懂。(现在手边没有程序)总之,我原来的程序在9.3上产生了一个标题位置换页及页面都很古怪的rtf文件。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-12-2 23:57:06
A revisited meta plot. JingJu


forest plot2.png
data anno;
  set meta end=Eof;
   length label $ 50 anchor $ 6 y1space $ 13 x1space $ 12 textcolor textStyle $12;
   retain function "text" y1space "datavalue" width 50 anchor "left" textsize 8 textweight "normal" ;
   textcolor ="black";
   textStyle ="normal";
   if study ='Overall' then do;
      textsize =8; textcolor ='orange'; textweight ="bold" ; textStyle ="italic";
   end;
   yc1=study;
   label=study;
   x1space="graphpercent";
   x1=1;
   output;
   label=summary;
   x1space="wallpercent";
   x1=101;
   output;
   if (Eof) then do;
      yc1=" ";
      x1space="wallpercent";
      y1space="graphpercent";
      anchor="bottom";
      y1=2;
      x1=25;
      label="Favors Treatment"; textweight ="bold"; textcolor ="green"; textStyle ="normal";
      output;
      x1=75;
      label="Favors Placebo"; textweight ="bold"; textcolor ="purple";
      output;
      y1space="wallpercent";
      x1space="wallpercent";
      y1=100;
      x1=-12;
      label="Study"; textweight ="bold"; textcolor ="black";
      output;
      x1=105;
      label="OR"; textweight ="bold"; textcolor ="black";
      output;
      x1=116;
      label="(LCL, UCL)";textweight ="bold";
      output;
   end;
run;




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-12-3 00:01:35
con't..
data attrmap;
  length  markercolor  linecolor  linepattern $12 fillcolor $20; drop year_type;
   retain ID "StudyName" markersymbol "squarefilled";
   set meta(keep =study year_type) end =Eof;
   retain markercolor  linecolor  linepattern ;
   value =study;
   if year_type =0 then do;
      markercolor ='red'; linecolor ='red';  linepattern ='solid'; fillcolor ='very_light_red';
   end;
   if year_type=1 then do;
      markercolor ='blue'; linecolor ='blue';  linepattern ='solid'; fillcolor ='very_light_blue';
   end;
   if study ='Overall' then do;
      markercolor ='orange'; linecolor ='orange';  markersymbol ="diamond"; linepattern ='shortdash';
   end;
run;
title 'Impact of Treatment on Mortality';
title2 height =7pt 'Odds Ratio and 95% CL';
ods rtf image_dpi =300;
proc sgplot data=meta nocycleattrs noautolegend sganno=anno dattrmap=attrmap pad=(left=18% right=22.5% bottom=5% top =1.5%);
yaxis reverse display=none;
xaxis type=log logbase=10 min=.01 max=100 minor display=(nolabel) offsetmin=0 offsetmax=0;
refline 1 / axis=x;
refline .01 .1 10 100 / axis=x lineattrs=GraphGridLines;
highlow y=study high=UpperCL low=LowerCL/ attrid=StudyName group =study;
scatter y=study x=oddsratio/ attrid=StudyName group =study;
bubble y =study x =oddsratio size =weight /datalabel =weight nooutline bradiusmin =0.045cm bradiusmax =0.090cm attrid=StudyName group =study;
run;
ods rtf close;


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-1-15 01:36:41
预祝大家春节愉快,万事如意。sas水平大大提高。京剧
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-1-15 06:02:28
9.3里面的 HPMIXED 支持的协方差阵类型更多,这个对我很重要。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-1-15 06:02:40
9.3里面的 HPMIXED 支持的协方差阵类型更多,这个对我很重要。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-2-3 19:03:46
关注inginging~~
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-2-4 22:31:22
想体验下SAS9.3的新画图功能, 可惜一直没有搞到9.3.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-2-5 03:10:01
9.3的画图功能在ODS上进一步增强。值得学习。
PROC SGPLOT gives PBSPLINE statement which can creates a fitted penalized B-spline curve. Do you know how different it is to the cubic spline curve provided in PROC GPLOT with symbol i =sm**? This question was from variogram plot from spatial analysis where LOESS method is too slow to bear.
Thanks in advance,
JingJu
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群