0

我有一个 PROC REPORT 输出,并希望根据单元格的值小于 1.96 添加一个星号。我不想要颜色,只是数字后面的星号。这可以通过格式完成,还是我需要在 COMPUTE 块中添加“IF/ELSE”子句?

data have1;
   input username $  betdate : datetime. stake winnings winner;
   dateOnly = datepart(betdate) ;
   format betdate DATETIME.;
   format dateOnly ddmmyy8.;
   datalines; 
    player1 12NOV2008:12:04:01 90 -90 0
    player1 04NOV2008:09:03:44 100 40 1
    player2 07NOV2008:14:03:33 120 -120 0
    player1 05NOV2008:09:00:00 50 15 1
    player1 05NOV2008:09:05:00 30 5 1
    player1 05NOV2008:09:00:05 20 10 1
    player2 09NOV2008:10:05:10 10 -10 0
    player2 09NOV2008:10:05:40 15 -15 0
    player2 09NOV2008:10:05:45 15 -15 0
    player2 09NOV2008:10:05:45 15 45 1
    player2 15NOV2008:15:05:33 35 -35 0
    player1 15NOV2008:15:05:33 35 15 1
    player1 15NOV2008:15:05:33 35 15 1
run;

PROC PRINT; RUN;

Proc rank data=have1 ties=mean out=ranksout1 groups=2;
     var    stake winner;
     ranks  stakeRank winnerRank;
run;

proc sql;
create table withCubedDeviations as
    select *,
    ((stake - (select avg(stake) from ranksout1 where stakeRank = main.stakeRank and  winnerRank = main.winnerRank))/(select std(stake) from ranksout1 where stakeRank = main.stakeRank and  winnerRank = main.winnerRank)) **3 format=8.2 as cubeddeviations
    from ranksout1 main;    
quit;

PROC REPORT DATA=withCubedDeviations NOWINDOWS out=report;
    COLUMN stakerank winnerrank, ( N stake=avg cubeddeviations skewness);
    DEFINE stakerank / GROUP  ORDER=INTERNAL '';
    DEFINE winnerrank / ACROSS  ORDER=INTERNAL '';
    DEFINE cubeddeviations / analysis 'SumCD' noprint;
    DEFINE N / 'Bettors';
    DEFINE avg / analysis mean 'Avg' format=8.2;
    DEFINE skewness / computed format=8.2 'Skewness';
    COMPUTE skewness;
        _C5_ =  _C4_ * (_C2_ / ((_C2_ -1) * (_C2_ - 2)));
        _C9_ =  _C8_ * (_C6_ / ((_C6_ -1) * (_C6_ - 2)));
    ENDCOMP;
RUN;

这只是一个例子,所以这在统计上没有意义,但如果 SKEWNESS 的值大于 1,我需要放一个星号,如果大于 5,则需要放两个星号,如果值大于 10,则需要放三个星号. 此外,如果星号可以是上标,那就更好了。

我一直在测试以下内容,但无济于事:

PROC FORMAT; 
    picture onestar . = " " low - high = "9.9999^{super *}";*^{super***};
    picture twostar . = " " low - high = "9.9999^{super **}";*^{super***};
    picture threestar . = " " low - high = "9.9999^{super ***}";*^{super***};
run;

PROC REPORT DATA=withCubedDeviations NOWINDOWS out=report;
    COLUMN stakerank winnerrank, ( N stake=avg cubeddeviations);
    DEFINE stakerank / GROUP  ORDER=INTERNAL '';
    DEFINE winnerrank / ACROSS  ORDER=INTERNAL '';
    DEFINE cubeddeviations / analysis 'SumCD' noprint;
    DEFINE N / 'Bettors';
    DEFINE avg / mean 'Avg' format=8.2;
    compute avg;
        if _C3_ > 1.96 then call define('_C3_','format','onestar.');
    endcomp;
RUN;

谢谢你的帮助。

4

1 回答 1

1

我认为这将满足您的需求:

proc format;
picture skewaskf
-1 <-<0 = '00009.99' (mult=100 prefix='-')
0-<1 = '00009.99' (mult=100) 
1-<5 = '00009.99*'(mult=100)
5-<10= '00009.99**'(mult=100)
10-high='00009.99***'(mult=100);
quit;

进一步扩大负面影响。

于 2013-09-15T18:05:22.497 回答