Dear All
bellow is the code i run :
Data SAm;
input Name $ Item $ Value ;
cards;
nehemiah ball 20
nehemiah bat 100
nehemiah glouse 50
naari battary 14
naari remote 40
naari cover 120
;
Run;
I want output like this
output:
naari battary 14
nehemiah ball 20
please help me with the code Proc Sql
Good. Please mark my answer as an accepted solution to help future users navigate the community
I assume that what you want is to take the obs with the minimum value for each name? If you want to do so with PROC SQL, this has nothing to do with first./last. logic, which is a SAS Data Step concept.
proc sql;
create table want as
select * from sam
group by name
having value=min(value);
quit;
Result:
name item value naari battary 14 nehemiah ball 20
thanks for the Solution.
and wrote a code in data step like this
Proc sort Data =Sam out=Sam_srt ;
By Name ;
Run;
Data Sam_1 ;
Set Sam_srt;
By Name ;
If First.name ;
Run;
Sir
i want output based on Name only.and can you write the code for above data step into Proc SQL.
Have you tried my code above?
Good. Please mark my answer as an accepted solution to help future users navigate the community
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.