/*i have the following dataset.*/

data score;
input marks ;
datalines;
10
20
30
40
50
60
70
80
90
100
;
run;

Now i should get the result as sum of 1 to 5 i.e(10+20+30+40+50)=150
and 2 to 6 i.e(20+30+40+50+60)=200
and 3 to 7 i.e(30+40+50+60+70)=250 and so on.
how to get it.
thanks in advance

Answer Posted / naveen kumar

proc transpose data=score out=score2 prefix= mark;
var marks;
quit;

data score2;
set score2;
sum1=sum(mark1,mark2,mark3,mark4,mark5);
sum2=sum(mark2,mark3,mark4,mark5,mark6);
sum3=sum(mark3,mark4,mark5,mark6,mark7);
sum4=sum(mark4,mark5,mark6,mark7,mark8);
sum5=sum(mark5,mark6,mark7,mark8,mark9);
sum6=sum(mark6,mark7,mark8,mark9,mark10);
run;

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know the features of sas?

592


explain the proc in sas? : Sas-administrator

616


what is the one statement to set the criteria of data that can be coded in any step? : Sas programming

646


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

551


Name validation tools used in SAS

689






what is the use of proc sql? : Sas programming

591


explain about various caches available in data integrator? : Sas-di

576


Differentiate between sas functions and sas procedures.

637


Explain the difference between nodup and nodupkey options?

605


How to specify variables to be processed by the freq procedure?

613


How will you react when, while consulting a SAS documentation manual to get an answer to a problem, someone says hey, I thought you were supposed to know all that stuff already, and not have to look it up in a book?

1940


What is the SAS data set?

674


Explain the difference between informat and format with an example.

678


What are the data types that sas contain?

649


How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?

746