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 */	
/*----------------*/

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Article Labels
Article Tags
Contributors