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 / karthik
data a;
input var;
cards;
0
1
2
3
-1
-2
-3
;
data report;
set a;
if var>=0 then var1=var;
else var2=var;
drop var;
run;
/*Report output*/
proc print data=report;
run;
Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
How is character variable converted into numeric variable and vice versa?
What are the differences between proc means and proc summary?
What are common programming errors committed in sas
What commands are used in the case of including or excluding any specific variables in the data set?
Explain proc univariate?
If a variable contains letters or special characters, can it be numeric data type?
what do the mod and int function do? What do the pad and dim functions do? : Sas programming
Enlist the syntax rules followed in sas statements.
Given an unsorted data set, how to read the last observation to a new data set?
What is the difference between reading data from an external file and reading data from an existing data set?
Name and describe few sas character functions that are used for data cleaning in brief.
describe the interaction table in sas di? : Sas-di
For clinical entire study how many tables will create approx?
Define run-group processing?
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.