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


Please Help Members By Posting Answers For Below Questions

How is character variable converted into numeric variable and vice versa?

593


What are the differences between proc means and proc summary?

599


What are common programming errors committed in sas

667


What commands are used in the case of including or excluding any specific variables in the data set?

587


Explain proc univariate?

604






If a variable contains letters or special characters, can it be numeric data type?

757


what do the mod and int function do? What do the pad and dim functions do? : Sas programming

610


Enlist the syntax rules followed in sas statements.

608


Given an unsorted data set, how to read the last observation to a new data set?

832


What is the difference between reading data from an external file and reading data from an existing data set?

632


Name and describe few sas character functions that are used for data cleaning in brief.

662


describe the interaction table in sas di? : Sas-di

589


For clinical entire study how many tables will create approx?

1520


Define run-group processing?

579


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.

1795