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

where to use sas business intelligence? : Sas-bi

575


How would you determine the number of missing or nonmissing values in computations?

646


how we can create a FLAG datasets? Ex:-ID age_group no_persons 1 to 10 10 to 20 3 11 to 20 21 to 30 7 21 to 3o 31 to 40 5

1654


What is the purpose of _character_ and _numeric_?

583


hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?

1660






What are SAS/ACCESS and SAS/CONNECT?

626


Mention the difference between ceil and floor functions in sas?

643


How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data?

634


Mention few capabilities of sas framework.

687


What is the length assigned to the target variable by the scan function?

670


Describe the ways in which you can create a macro variable?

622


hi all, I need the SAS DI DUMP(A00 260) for attending the certification. if any one have, pls provide it.Please Email to vrpotluri@hotmail.com. Thanks - Ramana

4907


What do the put and input function do?

583


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

549


what are informats in sas? : Sas-administrator

583