Help using Base SAS procedures

proc report url and row shading help

Reply
Occasional Contributor
Posts: 9

proc report url and row shading help

I'm working with the proc report code as shown below. I'm trying to do two things that aren't workout out as I expect:

1) Use the 'site' grouping variable as part of two URLs in two of the analysis variables. I have a 'compute before site' block set up where I assign 'site' to the 'this_site' variable which I use to construct the url, but only whitespace ends up in the final url. This is set up like the compute blocks for the platform and logop variables, which appear in the URLs fine.
2) Shade alternating groups based on the 'platform' variable. I have a 'dummy' computed variable that I use to shade the rows and do some traffic lighting. The row shading works, but the color changes one row before it should. I.e., the first five rows of 'group 1' are shaded as expected, but the sixth row is given the color for 'group 2.' This happens consistently for all groups.


proc report data = report_data_fam ( where = ( day >= TODAY() - 7 and src eq &src ) )
nowd
split = ' '
style( header ) = { background=CX5382A1
foreground=white
font_size = 3 }
style( column ) = { font_size = 3 };
column site src platform show_platform cusum_link logop show_logop day,
( red_status yellow_status units_tested units_failed kdpm ) dummy;
define site / ' ' group;
define src / ' ' group;
define platform / ' ' group;
define show_platform / ' ' computed noprint;
define cusum_link / ' ' group noprint;
define logop / ' ' group format = $ops. order = formatted;
define show_logop / ' ' computed noprint;
define day / ' ' across format = MMDDYY. descending;
define red_status / analysis noprint;
define yellow_status / analysis noprint;
define units_tested / 'T' analysis;
define units_failed / 'F' analysis;
define kdpm / 'KDPM' analysis format = 4. center;
define dummy / computed noprint;

/* Store values for constructing links. */
compute before site;
this_site = site;
endcomp;

compute before logop;
this_logop = logop;
endcomp;

compute show_logop / character length=3;
show_logop = this_logop;
endcomp;

compute before platform;
this_platform = platform;
endcomp;

compute show_platform / character length=10;
show_platform = this_platform;
endcomp;

compute units_tested;
urlstring = "&url_path"
||trim(this_site)||'_'||trim(this_logop)
||"&url_fname"
||trim(this_platform);
call define ( _col_, 'url', urlstring );
endcomp;

compute units_failed;
urlstring = "&url_path"
||trim(this_site)||'_'||trim(this_logop)
||"&url_fails_fname"
||trim(this_platform);
call define ( _col_, 'url', urlstring );
endcomp;

compute kdpm;
urlstring = trim(cusum_link);
call define ( _col_, 'url', urlstring );
endcomp;

compute dummy;
if mod( cnt, 2 ) then
call define( _row_, 'style', 'style=[background=CXFFFFFF font_weight=bold ]' );
else
call define( _row_, 'style', 'style=[background=CXD3D3D3 font_weight=bold ]' );

cnt+1;

/* Fill cells depending on red_status and yellow_status values. */
if _c8_ = 1 then do;
call define( '_c10_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c11_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c12_', 'style', 'style = { background = red font_weight=bold }' );
end;
else if _c9_ = 1 then do;
call define( '_c10_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c11_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c12_', 'style', 'style = { background = yellow font_weight=bold }' );
end;

if _c13_ = 1 then do;
call define( '_c15_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c16_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c17_', 'style', 'style = { background = red font_weight=bold }' );
end;
else if _c14_ = 1 then do;
call define( '_c15_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c16_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c17_', 'style', 'style = { background = yellow font_weight=bold }' );
end;

if _c18_ = 1 then do;
call define( '_c20_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c21_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c22_', 'style', 'style = { background = red font_weight=bold }' );
end;
else if _c19_ = 1 then do;
call define( '_c20_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c21_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c22_', 'style', 'style = { background = yellow font_weight=bold }' );
end;

if _c23_ = 1 then do;
call define( '_c25_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c26_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c27_', 'style', 'style = { background = red font_weight=bold }' );
end;
else if _c24_ = 1 then do;
call define( '_c25_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c26_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c27_', 'style', 'style = { background = yellow font_weight=bold }' );
end;

if _c28_ = 1 then do;
call define( '_c30_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c31_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c32_', 'style', 'style = { background = red font_weight=bold }' );
end;
else if _c29_ = 1 then do;
call define( '_c30_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c31_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c32_', 'style', 'style = { background = yellow font_weight=bold }' );
end;

if _c33_ = 1 then do;
call define( '_c35_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c36_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c37_', 'style', 'style = { background = red font_weight=bold }' );
end;
else if _c34_ = 1 then do;
call define( '_c35_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c36_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c37_', 'style', 'style = { background = yellow font_weight=bold }' );
end;

if _c38_ = 1 then do;
call define( '_c40_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c41_', 'style', 'style = { background = red font_weight=bold }' );
call define( '_c42_', 'style', 'style = { background = red font_weight=bold }' );
end;
else if _c39_ = 1 then do;
call define( '_c40_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c41_', 'style', 'style = { background = yellow font_weight=bold }' );
call define( '_c42_', 'style', 'style = { background = yellow font_weight=bold }' );
end;
endcomp;
run;
quit;
Ask a Question
Discussion stats
  • 0 replies
  • 147 views
  • 0 likes
  • 1 in conversation