BookmarkSubscribeRSS Feed
Tip Semanal 004: Sumar variables con missings
Berenice25
SAS Employee
Con el siguiente código podemos ver la diferencia de comportamiento de la función 'SUM' y el uso de '+', cuando se trabaja con valores faltantes (missings).
/********************************************************************************/
/* Ejemplo para sumar variables con valores missing				        		*/
/* Diferencia entre usar el símbolo '+' y la función 'Sum'			 	    	*/
/********************************************************************************/


/*-------------------*/
/* inicio del código */
/*-------------------*/

data prueba;
	infile DATALINES dsd missover;
	input var1 var2;
	cards;
1, .
., 2
5, 9
., .
;


data work.prueba;
	set work.prueba;
	var_sum_Symbol=var1+var2;
	var_sum_Function=SUM(var1,var2);
run;

/*----------------*/
/* fin del código */	
/*----------------*/

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
Article Labels
Article Tags
Contributors