Hi Guys, I need help with this error, i don't know which is the reason.
Error:
ERROR: The variable type of 'META_HOY_PR.SUM'n is invalid in this context.
NOTE: The preceding messages refer to the COMPUTE block for ef_gestion.
NOTE: Will not run due to compilation errors.
Code:
proc report data=rep_sup_pr1 nowd
box headskip center missing
style(header)=[foreground=white background=&ColorRep. bordercolor=black font_size=&RptFontZ.]
style(column)=[bordercolor=black just=c rules=group font_size=&RptFontZ.];
columns ("Reporte"
CANTIDAD
CANTIDAD_TR
ef_contacto
ef_gestion
);
define DESC /group 'Desc' width=25 style(column)=[ just=l cellpadding=0pt];
define cantidad /display sum 'Cantidad' format=comma10.0 ;
define cantidad_tr /display sum 'Cantidad Trabajada' format=comma10.0 ;
define ef_contacto /computed '% Efectividad Contacto' format=percent10.1 ;
define ef_gestion /computed '% Efect. Gestión' format=percent10.1 ;
compute ef_contacto;
ef_contacto = cantidad_tr.sum / cantidad.sum;
endcomp;
compute ef_gestion;
ef_gestion = cantidad_tr.sum / gestion.sum;
endcomp;
run;
META_PR.SUM is referring to the SUM statistic for a column named META_PR.
But there is no column named META_PR in your COLUMN statement.
Variable cantidad_tr's usage is display NOT analysis , therefore use itself name .
ef_contacto = cantidad_tr / cantidad ;
Hi xia, this is the complet code, the error is in the block compute "compute ef_gestion;":
I test with a static number and run correctly, but with the variable.sum not run.
compute ef_gestion; |
ef_gestion = cantidad_tr.sum / 17;
endcomp;
Code Complete:
proc report data=rep_sup_pr1 nowd
box headskip center missing
style(header)=[foreground=white background=&ColorRep. bordercolor=black font_size=&RptFontZ2.]
style(column)=[bordercolor=black just=c rules=group font_size=&RptFontZ2.];
title;
title3;
title4;
footnote;
columns ("Reporte"
NEWSEG_DESC_OFICINA
NEWSEG_DESC_OFICIAL
CANTIDAD
CANTIDAD_TR
CANTIDAD_PR
OFERTA_PR_SUM
OFERTA_TR_SUM
DESEMBOLSO_PR_SUM
ef_contacto
ef_colocado
ef_trabajado
ef_gestion
);
define NEWSEG_DESC_OFICINA /group 'Oficina' width=25 style(column)=[ just=l cellpadding=0pt];
define NEWSEG_DESC_OFICIAL /group 'Oficial' width=25 style(column)=[ just=l cellpadding=0pt];
define cantidad /display sum 'Cantidad Ofertar' format=comma10.0 ;
define cantidad_tr /display sum 'Cantidad Trabajada' format=comma10.0 ;
define cantidad_pr /display sum 'Cantidad Colocada' format=comma10.0 ;
define oferta_pr_sum /display sum 'Monto Oferta' format=dollar20.0;
define oferta_tr_sum /display sum 'Monto Oferta Trabajada' format=dollar20.0;
define desembolso_pr_sum /display sum 'Monto Desembolsado' format=dollar20.0;
define ef_contacto /computed '% Efectividad Contacto' format=percent10.1 ;
define ef_trabajado /computed '% Efectividad Trabajado' format=percent10.1 ;
define ef_gestion /computed '% Cumplimiento Gestión' format=percent10.1 ;
define ef_colocado /computed '% Efectividad Colocado' format=percent10.1 ;
define tot_gestion /analysis noprint;
define tot_contacto /analysis noprint;
define tot_colocado /analysis noprint;
define tot_trabajado /analysys noprint;
define tot_canal /analysis format =6. "Total Canal";
compute before NEWSEG_DESC_OFICINA;
tot_contacto = cantidad.sum;
tot_colocado = cantidad_pr.sum;
tot_trabajado = cantidad_tr.sum;
tot_gestion = meta_pr.sum;
endcomp;
compute ef_contacto;
ef_contacto = cantidad_tr.sum / cantidad.sum;
endcomp;
compute ef_trabajado;
ef_trabajado = cantidad_pr.sum / cantidad_tr.sum;
endcomp;
compute ef_gestion;
ef_gestion = cantidad_tr.sum / meta_pr.sum;
endcomp;
compute ef_colocado;
ef_colocado = cantidad_pr.sum / cantidad.sum;
endcomp;
compute after NEWSEG_DESC_OFICINA;
NEWSEG_DESC_OFICINA = 'Total';
call define (_row_,'style',"style=[foreground=white background=&ColorRep. bordercolor=black font_weight=bold]");
endcomp;
compute after;
NEWSEG_DESC_OFICINA = 'Total General';
call define (_row_,'style',"style=[foreground=white background=&ColorRep. bordercolor=black font_weight=bold]");
endcomp;
break after NEWSEG_DESC_OFICINA/ summarize skip dul;
rbreak after / dol summarize;
run;
DataSet:
Log Error Message:
NOTE: Multiple concurrent threads will be used to summarize data.
ERROR: The variable type of 'META_PR.SUM'n is invalid in this context.
NOTE: The preceding messages refer to the COMPUTE block for ef_gestion.
ERROR: The variable type of 'META_PR.SUM'n is invalid in this context.
NOTE: The preceding messages refer to the COMPUTE block for BREAK BEFORE NEWSEG_DESC_OFICINA.
META_PR.SUM is referring to the SUM statistic for a column named META_PR.
But there is no column named META_PR in your COLUMN statement.
Very thanks so much, I added the in the column statement and the problem was resolved.
Thanks Sir Tom.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.