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

Explain the difference between informat and format with an example.

678


how many types prompting framework can be broken down to? : Sas-bi

626


Explain bmdp procedure?

612


What is substr function?

622


How to limit decimal places for variable using proc means?

587






How to test the debugging in sas?

606


Mention the difference between ceil and floor functions in sas?

642


What was the last computer book you purchased? Why?

1910


What is a method for assigning first.VAR and last.VAR to the BY group variable on unsorted data?

2003


How to sort in descending order?

786


what has been your most common programming mistake? : Sas programming

562


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

574


how to do user inputs and command line arguments in sas?

2426


Mention what is the difference between nodupkey and nodup options?

595


What is the difference between where and if statement?

617