BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
wilsonger
Calcite | Level 5

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

View solution in original post

4 REPLIES 4
Ksharp
Super User

Variable cantidad_tr's usage is display NOT analysis , therefore use itself name .

ef_contacto = cantidad_tr / cantidad ;

wilsonger
Calcite | Level 5

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:

Segmento.png


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.

Tom
Super User Tom
Super User

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.

wilsonger
Calcite | Level 5

Very thanks so much, I added the in the column statement and the problem was resolved.

Thanks Sir Tom.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 4106 views
  • 0 likes
  • 3 in conversation