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

What is the use of %include statement?

0 Answers  


i want to upload titles and footnotes to excel file?how it is possible?

1 Answers  


I Here clinical SAS training by Ramesh Azmeera is good. Is it confirm ?

2 Answers  


What is the difference between using drop = data set option in data statement and set statement?

0 Answers  


What is the good sas programming practices for processing large data sets?

0 Answers  


what is sas and what are the functions? : Sas-administrator

0 Answers  


data study; input Subj : $3. Group : $1. Dose : $4. Weight : $8. Subgroup; x= input(Weight,5.1); datalines; 001 A Low 220 2 002 A High 90 1 003 B Low 193.6 1 004 B High 165 2 005 A Low 123.4 1 ; Why does X get truncated? X shows up as 22 instead of 220,9 instead of 90 and 19.8 instead of 198? This problem doesnt happen with the values 193.6 and 123.4. This does not happen if x is read on the 5. informat instead of the 5.1 informat

2 Answers  


I am having a stored process.it needs to route my report to both hthml and Xls.By default SP routes to html.I used the PRINTTO to route the html to Xls.BUt it createsthe file not but no content was written to file(0KB)?how can i do it?

1 Answers  


Explain append procedure?

0 Answers  


how do u validate sas program

3 Answers   Accenture,


what is intially documentation for a sas programmer?

2 Answers   Accenture,


how do you validate sas program?

6 Answers   Accenture,


Categories