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

Describe the ways in which you can create macro variables? : sas-macro

770


where are dashboard components are created and maintained? : Sas-bi

773


What are the functions used for character handling?

868


What is the role of unrestrictive users? : sas-grid-administration

769


how could you generate test data with no input data? : Sas programming

872


What are the five ways to do a table lookup in sas? : sas-grid-administration

803


what does the run statement do? : Sas programming

769


What is a method to debug and test your SAS program?

965


what is the difference between nodup and nodupkey options? : Sas programming

862


How can you limit the variables written to output dataset in data step?

1012


how many types of prompts are there? : Sas-bi

733


Give some examples where proc report’s defaults are same as proc print’s defaults?

870


What is by-group processing?

746


what is sas and what are the functions? : Sas-administrator

732


How will you generate test data with no input data?

799