if i having variables named a b c d e f ,how to find total of
each variable ????give syntax...??
Answers were Sorted based on User's Feedback
Answer / shambhu verma
There are various method for it but the simple way to find
out total / sum of each numerical variables is...........
Proc print data= sas data set;
sum var-list;
run;
| Is This Answer Correct ? | 18 Yes | 0 No |
Answer / puja
Its total of each variable and not row total i suppose
hence the syntax can be given as
proc sql;
create table SUM as
select sum(a) as sum_a,
sum(b) as sum_b,
sum(c) as sum_c,
sum(d) as sum_d,
sum(e) as sum_e,
sum(f) as sum_f
from input_dataset_name;
quit;
| Is This Answer Correct ? | 8 Yes | 3 No |
Answer / manoj
Or instead of giving all the var-list you can just give:-
Proc print data= sas data set;
sum _numeric_;
run;
It will give sum of all the numeric variable present in the dataset.
Else if you have all the variables as numeric type, then you can give :-
Proc print data= sas data set;
sum _all_;
run;
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / anik chatterjee
The last answer is right but if all the values are missing
then sum function will give a note in log. Best way to add
0 with all value. Hence if all value is missing then total
would be 0 and no note will be there.
proc sql;
create table SUM as
select sum(a) as sum_a,
sum(b,0) as sum_b,
sum(c,0) as sum_c,
sum(d,0) as sum_d,
sum(e,0) as sum_e,
sum(f,0) as sum_f
from input_dataset_name;
quit;
| Is This Answer Correct ? | 0 Yes | 5 No |
Do you know the features of sas?
What type of tables you are using in YOUR reporting..???
2 Answers GSK GlaxoSmithKline,
explain what is data set in sas? : Sas-administrator
How would you identify a macro variable?
What is the difference between SAS Data step and SAS PROC SQL, and which is better?
what are the types of interactive display types? : Sas-bi
What are the ways in which macro variables can be created in sas programming?
What is the order of application for output data set options, input data set options and SAS statements?
What is instream data in SAS?
How do you download a flat file from Mainframe to your local PC using SAS?
what other SAS features do you use for error trapping and data validation?
What is the command used to find missing values?