11-20-2013 09:19 PM
I would like to be able to create a table that alternates the row color to distinguish between cities. However, the variable cities is not unique as it is possible for the city to appear in the table more than once. I would like to keep and have each different city the same color and alternating colors between different cities......any suggestions would be greatly appreciated...thanks.
11-21-2013 08:58 PM
I am using the proc report procedure....and would like it to alternating between white and grey for each different city so as to identify the results for each city .
11-21-2013 11:26 AM
How many cities do you have? Do you want to control the color of the cities or have them automatically selected, which could be interesting if you have a lot of cities.
I'm a bit confused with the alternating colour yet each city the same color? Do you want 2 colors that alternate, but this is done for multiple rows at a time or should each city have its own color?
11-21-2013 09:02 PM
The number of cities can vary from time to time depending when the program is ran and the time of year that the data is being extracted. I am not too concern about the colors (white and grey is fine) as long as it is possible to distinguish the result on the table between cities.
11-21-2013 11:29 AM
this can be done in proc report, by using a line number and checking if it is even or odd.
something along the lines of
if mod(LINE_COLOR, 2) gt 0 then
11-21-2013 11:31 AM
This is the basic concept, but then you'd want to change this from instead of incrementing every single row, increment only when you have a change in city. Perhaps just store the last-seen city name and alter the color when it's not the same as the current one.
11-21-2013 11:35 AM
11-21-2013 11:59 AM
Modified to simply alternate:
where Subsidiary in('Addis Ababa' 'Algiers' 'Cairo' 'Khartoum');
proc report data=colors nowd;
column subsidiary sales;
define subsidiary / order;
define sales / display;
compute before subsidiary;
if mod(colorcol,2)=1 then
where sales gt 70000;
ods html close;
You can also do something like this in PROC TABULATE; see http://support.sas.com/resources/papers/stylesinprocs.pdf for examples of using CLASSLEV and formats to modify row colors.
11-21-2013 09:06 PM
Hi Scott...thanks for your suggestion. The problem is that I do not know in advance how many cities will be in the table and for the most part, it would seem like it could be numerous cities....so specifying a color for a particular city would not work for me but I am fine with it alternating between white and grey....Thanks once again/