how to add distinctly var variable values ex..
Data a;
input var;
datalines;
0
1
2
3
-1
-2
-3
;
run;
adding all +ve value in one varibale n do the same for -ve
too

Answer Posted / arun kumar

proc sql;
create table arun as
select sum(case when var>=0 then var else . end) as num_p,
sum(case when var<0 then var else . end) as num_n
from a;
quit;

proc print;
run;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

For a user to have access to a standard workspace server, is internal authentication alone is sufficient? : sas-grid-administration

540


In ARRAY processing, what does the DIM function do?

715


what is the Population you used in your project, is it ITT or PP?

2185


Mention what is PROC in SAS?

605


which date function advances a date, time or datetime value by a given interval? : Sas programming

602






what are informats in sas? : Sas-administrator

591


why is sas data integration studio important? : Sas-di

565


what are the softwares and applications that are used most frequently used by sas bi applications developers? : Sas-bi

560


What is the use of divide function?

610


How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?

752


what r the job openings SAS for fresher graduates !

2021


For what purposes have you used sas macros? : sas-macro

540


What is the difference between reading data from an external file and reading data from an existing data set?

641


Explain the purpose of retain statement.

608


How would you code a macro statement to produce information on the sas log? This statement can be coded anywhere? : sas-macro

587