0

我正在尝试使用 proc 格式在报告中创建交通灯。但即使值可以大于 1 或小于 1,颜色始终是最低颜色。在这种情况下,它们都是红色的。为什么 SAS 看不到这些值?

proc format; 
value forecast 
   low - < 0.70 = 'red'
   0.70 - <0.90 = 'yellow'
   0.90 - high = 'green';
run;

%macro perform_target  (cc, year, career_id, cc_name) ;

data Performance_&career_id._&cc._&year. ;
    set post_target_comparisons1;
    where institution = "&cc." and year = "&year." and career_id = "&career_id.";
run;

ods excel file = "Y:\General - CTE\2019 CTE Accountability\2020\Need Assessment Performance 
Tables\Performance_&career_id._&cc._&year..xlsx" style = sasdocprinter;

    ods excel options(autofilter="2-39" sheet_name = "Performance &year." embedded_titles = 'yes'); 
    run;

    title j= C "Actual to Target Comparisons";
    title2 j = C "Academic Year - &year.";
    run;

    proc report data = Performance_&career_id._&cc._&year.;

    column community_college cluster_label measure_label year total_students total_male percent_male 
    target forecast_male forecast_female forecast_AI forecast_AS forecast_AA forecast_HI forecast_PI 
    forecast_W forecast_MU forecast_disabled forecast_farms forecast_single forecast_displaced 
    forecast_ell forecast_nontrad;

     define forecast_male/display 'Percent to Forecast Male' style(column) = [cellwidth=1in 
     tagattr="format:####.##\%" fontweight = bold foreground = forecast.];

     run;

    ods excel close;

    %mend perform_target;

    %perform_target (010042, 2016, 01);
4

1 回答 1

1

这有效,所以我希望您的数据是问题所在。

proc format; 
   value forecast 
      low - < 0.70 = 'red'
      0.70 - <0.90 = 'yellow'
      0.90 - high = 'green';
   run;

data have;
   do x = 0 to 1 by .05;
      output;
      end;
   run;
ods excel file='test.xlsx';
proc report data=have list;
   columns x;
   define x / display /*format=percent12.2*/ style(column)=[cellwidth=1in tagattr="format:####.##\%" fontweight = bold foreground = forecast.];
   run;
ods excel close;
于 2020-01-09T21:18:29.310 回答