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
what is sas metadata server? : Sas-di
What are symget and symput? : sas-macro
explain what is data set in sas? : Sas-administrator
explain the key concept of sas? : Sas-administrator
what is slowly changing dimension? : Sas-di
What does PROC print, and PROC contents do?
What is PDV?
what is metadata? : Sas-bi
what are some problems you might encounter in processing missing values? In data steps? Arithmetic? Comparisons? Functions? Classifying data? : Sas programming
data data1; input dt account; format dt date9.; cards; 1745 1230 1756 1120 1788 1130 1767 1240 ; data data2; input startdt enddt total; format startdt date9. enddt date9.; cards; 1657 1834 12300 1557 1758 16800 1789 1789 12300 1788 1345 12383 1899 1899 13250 ; proc sql; create table data3 as select * from data1 as x left join data2 as y on x.dt>=y.startdt and x.dt<=y.enddt; quit; Here, we are getting cartision product. But,I want left join report consisting of this program. It should not get duplicate values. you can modify the program also.
Explain how you can debug and test your SAS program?
if the Id has more then two transcatiion then show the first observation, IF Id has only two observation then It show both the observation
What is the basic syntax of a sas program?
Explain proc sort?
What is the basic structure of a sas program?