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



if i having variables named a b c d e f ,how to find total of each variable ????give syntax...??..

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

if i having variables named a b c d e f ,how to find total of each variable ????give syntax...??..

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

if i having variables named a b c d e f ,how to find total of each variable ????give syntax...??..

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

if i having variables named a b c d e f ,how to find total of each variable ????give syntax...??..

Answer / naveen

proc print data=qqq;
sum a b c;
or
sum _all_;
run;

Is This Answer Correct ?    1 Yes 0 No

if i having variables named a b c d e f ,how to find total of each variable ????give syntax...??..

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

if i having variables named a b c d e f ,how to find total of each variable ????give syntax...??..

Answer / ak

sum = sum(of a-f);

Is This Answer Correct ?    3 Yes 16 No

Post New Answer

More SAS Interview Questions

tell me about use of arrays in sas

1 Answers   CoreEL,


how to read the variables in sas? : Sas-administrator

0 Answers  


Why is SAS considered self-documenting?

1 Answers   Quintiles,


Hi, I have one dataset, could you please ans for this. id amount paid_amount 1 700 400 2 900 250 3 300 300 a 400 250 b 500 320 c 800 650 x 200 190 y 900 250 z 300 180 i want create new dataset having id and paid_amount who are paid high amount comparing amount. ex: 1d paid_amount 3 300 c 650 x 190

3 Answers  


how does sas handle missing values in a merge? : Sas programming

0 Answers  






Does anybody has SAS Platform Administration certification dumps. pls send to hariithepalli@gmail.com

0 Answers  


What are the different operating system platforms in which we can use sas? : sas-grid-administration

0 Answers  


Can we replace a dataset into view?

6 Answers   CliniRx,


i have a dataset with 25 obs; 10th obs has like ramu,anji,ramu,azad,ramu like this. i want to know how many times the word repeats in that obs?

3 Answers  


What are the features of SAS?

0 Answers  


Describe what are the different levels of administrative users in sas? : sas-grid-administration

0 Answers  


How to Rename Library?

3 Answers  


Categories