/*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
Hi all, If Anybody has Advance SAS Certification dumps??? Please share with me. Email: pramod.kalugade03@gmail.com
What are the best sas programming practices for handling very large datasets? : sas-grid-administration
I need level 2 to 5 sas using companies in india
Mention how to limit decimal places for the variable using proc means?
Explain append procedure?
Why double trailing @@ is used in input statement?
what is function of retain statment
: and & modifiers.
Compare sas with other data analytics tools.
what techniques and/or procs do you use for tables? : Sas programming
Explain data step in SAS
what is information maps?
How do you control the number of observations and/or variables read or written? Approximately what date is represented by the SAS date value of 730?
Give some examples where proc report’s defaults are different than proc print’s defaults?
State the difference between INFORMAT and FORMAT ?