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

What are the different types of sas functions?

842


what is intially documentation in sas?

4604


what is the difference between floor and ceil functions in sas? : Sas-administrator

917


For clinical entire study how many tables will create approx?

1709


How would you define the end of a macro? : sas-macro

834


In sas, what are the areas that you are most interested in? : sas-grid-administration

819


How do you delete duplicate observations in sas?

795


What will calendar procedure do?

814


Name and describe few sas character functions that are used for data cleaning in brief.

865


what is treatment emergent events and treatment emregent adverse event

2136


What is the difference between class statement and by statement in proc means?

883


Why and when do you use proc sql?

959


How substr function works in sas?

878


If you have a dataset that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variables?

895


Explain the special input delimiters used in sas programming.

761