Hello: Is there any way to reference a cell to the right or to the left of the present value? I'm trying to compare the value of a cell with the value of the cell to the left of it, but I haven't been able to make it work in an elegant way. I have the following code: proc report data= ControlDiario showall out=columnas; where Central = "&PowerPlant"; columns ('VLE' '' 'Superaciones' Dia) Grupo, ModoFuncionamiento, Medida, VLE, Superaciones, (VLEComparacion Valor); define Dia / group order=internal style(column)={width=160 tagattr='type:DateTime format:DD/MM/YYYY'}; define Grupo / across '' format=&FormatoGrupos preloadfmt order=data; define ModoFuncionamiento / across nozero ''; define Medida / across '' format=$FormatoMedida. preloadfmt order=data; define Superaciones / across ''; define VLE / across ''; define VLEComparacion / noprint; compute Valor; call symputx('ColValor', cats('_c', _col_, '_')); call symputx('ColVLE', cats('_c', _col_ - 1, '_')); if symget('ColValor') > symget('ColVLE') then do; call define(_col_, 'style', 'style=[background=very_light_vivid_red]'); end; endcomp; I thought ColValor would get the number of the present column (_col_) and I could compare it with the column to its left (ColVLE with value _col_ - 1), but the macro variables are not getting the right values. On the other side, this is working, but I have to create a big array every time: proc report data = ControlMensual;
columns ("VLE" '' 'Superaciones' Mes) Grupo, ModoFuncionamiento, Medida,
VLE, Superaciones, (VLEComparacion Valor);
define Mes / group format=FormatoMeses. preloadfmt order=data;
define Grupo / across '' format=&FormatoGrupos preloadfmt order=data;
define ModoFuncionamiento / across nozero '';
define Medida / across '' format=$FormatoMedida. preloadfmt order=data;
define Superaciones / across '';
define VLE / across '';
define VLEComparacion / noprint;
compute Valor;
array Columnas(2000)
%do i = 1 %to 2000; _c&i._ %end;;
if Columnas(_col_) > Columnas(_col_ - 1) then
call define(_col_, 'style', 'style=[background=very_light_vivid_red]');
endcomp;
run; Do you know any way to resolve the name of the macros in the first code so that I can compare the present column with another one to the left of it? Thanks and regards, Jordi
... View more