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
How do you use the do loop if you don’t know how many times you should execute the do loop?
describe the interaction table in sas di? : Sas-di
how sas deals with business intelligence? : Sas-bi
how would you determine the number of missing or nonmissing values in computations? : Sas programming
I have a dataset concat having a variable a b & c. How to rename a b to e & f?
Difference between nodup and nodupkey options?
Tell me more about the parameters in macro? : sas-macro
What does the RUN statement do?
How to limit decimal places for the variable using proc means?
What is the use of PROC gplot?
What do the sas log messages “numeric values have been converted to character” mean? What are the implications?
Is the physical structure of the data set in the same orientation as the report? Do you need to reshape the data sets? What method should you use to reshape the data–DATA steps,PROC TRANSPOSE,output data set from a procedure?
what is change analysis in sas di ? : Sas-di
if a variable contain dates like "2015/01"---"2015/12" (yymm) ,How to add day to those dates,if them month is jan then 31 if the month is feb then 28 so on ...
what are the types of interactive display types? : Sas-bi