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 / ravikumar marappan

data test;
input var;
retain sub;
retain ad;
if var < 0 then sub=sum(sub,var);
else ad=sum(ad,var);
datalines;
1
2
3
-1
-2
-3
;
run;

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Mention what are the data types does SAS contain?

701


Which statement does not perform automatic conversions in comparisons?

1207


what is enterprise guide? What is the use of it? : Sas programming

541


What do the mod and int function do? : Sas programming

586


what are input dataset and output dataset options? : Sas programming

567






Mention sas system options to debug sas macros.

666


how do the in= variables improve the capability of a merge? : Sas programming

943


what is the difference between: x=a+b+c+d; and x=sum (of a, b, c ,d);? : Sas programming

613


How are numeric and character missing values represented internally?

1142


How will you react when, while consulting a SAS documentation manual to get an answer to a problem, someone says hey, I thought you were supposed to know all that stuff already, and not have to look it up in a book?

1948


What is the use of %include statement?

623


what is transformation in sas data integration? : Sas-di

560


What is a pdv and what are its functions?

603


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

612


Define run-group processing?

583