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

Dear all, proc means data=dsn noprint completetypes; class trtmntgroup /preloadfmt; output out=tot n=n; format trtmntgroup trtf. ; by vstgrp descending severity; run; This is the code I used for AE table. I got the values without giving the variable ‘trtmntgroup(numeric)’ in var statement. And if I give the var statement for that variable i’m getting the same values.How is that possible? What is the difference between class and var statement? Could any one explain me how does proc means work at the back end. And what is the difference between _freq_ value and N value in proc means. Thanks and regards, Rajesh.

1 Answers  


What are common programming errors committed in sas

0 Answers  


In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single variable)

8 Answers   GSK GlaxoSmithKline,


hi here is a problem can anybody solve this? i want to report the data through third party file. by using data _null_ or proc report or macro automation process. but i want to insert the 'titles and footnotes' in between the data and also starting of 2nd and ending of 2nd and starting of 3rd and ending of the 3rd page. tell me how and write the code?

0 Answers   Cognizant,


How to display duplicate observations in data?

1 Answers  






how do you pull data from equifax?tell me the process?

0 Answers   Synchrony Financial,


What is the difference between %put and symbolgen? : sas-macro

0 Answers  


how do you read binary data in sas?

3 Answers   Satyam,


What does PROC print, and PROC contents do?

0 Answers  


Are the preferred term counts are always equal to Body system counts? If so, Why are they equal if not why they are not equal?

1 Answers   Icon,


explain the use of % includes a statement in sas? : Sas-administrator

0 Answers  


Give e an example of..

0 Answers  


Categories