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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Article Labels
Article Tags
Contributors