you have a data set like this.
data qqq;
input name $ total;
cards;
qq 22
ww 33
qq 22
ee 44
rr 33
ww 44
;
run;
and you want output like this.........
name total
qq 22
ww 44

Do it by data set step.

Answers were Sorted based on User's Feedback



you have a data set like this. data qqq; input name $ total; cards; qq 22 ww 33 qq 22 ee 44 ..

Answer / bharath

data abc1;
set qqq end=a;
if _n_=1 or a=1;
proc print data=abc1;
run;

Is This Answer Correct ?    12 Yes 0 No

you have a data set like this. data qqq; input name $ total; cards; qq 22 ww 33 qq 22 ee 44 ..

Answer / vishal

proc sort data=qqq;
by name;
run;

data f;
set qqq;
by name;
if first.name=0;
run;

Is This Answer Correct ?    1 Yes 0 No

you have a data set like this. data qqq; input name $ total; cards; qq 22 ww 33 qq 22 ee 44 ..

Answer / alok karan

data qq;
do i=1 to n by n-1;
set qqq point=i nobs=n ;
output;
end;
stop;
proc print data=qq;
run;

/*Above is more efficient program to know the first and last observation */

Is This Answer Correct ?    0 Yes 0 No

you have a data set like this. data qqq; input name $ total; cards; qq 22 ww 33 qq 22 ee 44 ..

Answer / ashish

data op;
set qqq end=last;
if _n_=1 or last=1 then output;
run;

Is This Answer Correct ?    0 Yes 0 No

you have a data set like this. data qqq; input name $ total; cards; qq 22 ww 33 qq 22 ee 44 ..

Answer / bharath

data qqq;
input name $ total;
cards;
qq 22
ww 33
qq 22
ee 44
rr 33
ww 44
;
run;


data abc;
set qqq;
if total in (22,44) and name in ('qq', 'ww');
proc print;
run;

data abc1;
set abc;
by name;
if first.name;
run;
proc print;
run;

Is This Answer Correct ?    1 Yes 2 No

you have a data set like this. data qqq; input name $ total; cards; qq 22 ww 33 qq 22 ee 44 ..

Answer / singh.naveen409

proc sort data=qqq;
by name;
run;
options mlogic;
data www;
set qqq;
by name;
if first.name then serial=1
run;
data wwq (drop=serial);
set www;
if serial ne '1';
run;

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More SAS Interview Questions

how does sas handle missing values in an update? : Sas programming

1 Answers  


Under what circumstances would you code a SELECT construct instead of IF statements?

4 Answers  


how could you generate test data with no input data? : Sas programming

0 Answers  


What are the differences between sum function and using “+” operator?

0 Answers  


Hi All.I am looking for Good Institute who could Provide the online SAS BI+DI Training along with software.Primarily in Delhi/NCR or in Hyderabad Please help with name and contact number of concerned person!! Thanks in Advance! :)

1 Answers  






what is information maps?

0 Answers   CitiGroup,


Which is the Best SAS training Institute in Delhi NCR for SAS certification preparation

1 Answers   SAS,


What is the maximum length of the macro variable?

0 Answers  


What do you feel about hardcoding?

1 Answers  


I am preparing SAS Certified Advanced Programmer for SAS 9 in 2014. If anybody has the latest dumps for this exam, please mail me at dhiman.mukherjee@gmail.com

0 Answers  


In PROC PRINT, can you print only variables that begin with the letter “A”?

8 Answers  


what are the advantages of using SAS in clinical data mangement? why should not we use other software products in managing clinical data?

2 Answers   Wockhardt,


Categories