Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


/*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

Answers were Sorted based on User's Feedback



/*i have the following dataset.*/ data score; input marks ; datalines; 10 20 30 40 50 60 ..

Answer / 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

/*i have the following dataset.*/ data score; input marks ; datalines; 10 20 30 40 50 60 ..

Answer / 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

More SAS Interview Questions

what are all the ways to define macro variable??

2 Answers   GSK GlaxoSmithKline,


hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?

0 Answers   Pfizer,


What does the trace option do?

0 Answers  


Explain why double trailing @@ is used in input statement?

0 Answers  


How would you combine 3 or more tables with different structures?

7 Answers  


If you were told to create many records from one record show how you would do this using arrays and with PROC TRANSPOSE?

1 Answers   HCL, Quintiles,


i have multiple .csv files in a unix directory. every file is having variable names as header.even for empty file also. suppose take 3 files a.csv b.csv c.csv a.csv contains data as name;age,salary; raja;34;4000; ravi;33;5000; kumar;25;3000; b.csv contains data as name;age,salary; ajay;40;4500; and c.csv contains name;age,salary; (only headers) Now i want to import and append all these files in to a single dataset. i tried infile statement with *.csv to import all at a time. but i m not getting correct data. please help me . its urgent. thank you in advance

2 Answers   Tech Mahindra,


HOW MANY WAYS YOU CAN RETRIEVE THE DATA FROM ORACLE TABLES? WHAT IS ORACLE CLINICAL? HOW IT IS USEFUL?

3 Answers   Accenture, Novartis,


i have a dataset with 100000 records. i want 100 records from that dataset and create a dataset.we need to pick the observations random order like 100obs,500obs,1020obs,1890obs,2565obs like that i need 100 obs in random order? how can we create this one?

5 Answers   L&T,


how can you sort the dataset having millions of OBS(instead of sort procedure?

4 Answers   EXL,


whenever we using the merging through data set merging ,we can get note in log like this "MERGE STATEMENT HAS MORE THAN ONE ONE DATASET BY REPEATED BY VAIABLES" but the output has come in good manner,whenever in in sql(full join) we can get cartion product.so How do overcome this problem in sql?

1 Answers   Accenture,


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

0 Answers  


Categories