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
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 |
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 |
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 |
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 |
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 |
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 |
what is pdv? how it is related to input buffer in sas?
how to rearrange the data as our wish by using dataset block?
do you prefer proc report or proc tabulate? Why? : Sas programming
What is the order of evaluation of the comparison operators: + - * /** ()?
How do you control the number of observations and/or variables read or written?
What are exact SAS Base contents..?N what r SAS Tools..?
What are the different versions of sas that you have used until now? : sas-grid-administration
In the flow of DATA step processing, what is the first action in a typical DATA Step?
How to get part of string form the source string without using sub string function in SAS?
what are the considerations when picking a SAS/STAT procedure?
0 Answers Accenture, Quintiles,
Explain the difference between using drop = data set option in set and data statement?
What are the scrubbing procedures in sas?