/*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 / tandon
PROC TRANSPOSE DATA=SCORE OUT=SCORE2 NAME=SUBJECT PREFIX=MARKS;
VAR MARKS;
RUN;
PROC PRINT DATA=SCORE2;
RUN;
DATA SUM;
SET SCORE2;
A=SUM(OF MARKS1 - MARKS5);
B=SUM(OF MARKS2 - MARKS6);
C=SUM(OF MARKS3 - MARKS7);
D=SUM(OF MARKS4 - MARKS8);
E=SUM(OF MARKS5 - MARKS10);
RUN;
PROC PRINT DATA=SUM HEADING=H;
OPTIONS LS=150;
RUN;
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
explain the key concept of sas? : Sas-administrator
Explain data step in SAS
Name and describe few sas character functions that are used for data cleaning in brief.
how many types prompting framework can be broken down to? : Sas-bi
In proc transpose and data step with arrays which one you pick?
what are some good sas programming practices for processing very large data sets? : Sas programming
How to read an input file in sas?
Give an example where SAS fails to convert character value to numeric value automatically?
Name any two sas spawners? : sas-grid-administration
What is the role of unrestrictive users? : sas-grid-administration
where to use sas business intelligence? : Sas-bi
What is PDV?
What is the difference between INPUT and INFILE ?
What does PROC print, and PROC contents do?
what is PhaseIII, ODS, TLG, Macro and Proc in SAS