BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have more observations for the same subject, what i want to do is select only subjects with one observetion. How can I do this?
dataset is similar to this:
id blood pressure
1 130
2 120
3 140
3 160
3 125
4 120
4 135
4 130

i want only subjects with one misuration i.e subject number 1 and 2 in this example
thank you
2 REPLIES 2
yonib
SAS Employee
Hi ,
There are several ways of doing it ,
For example :

data temp;
input id blood_pressure;
cards;
1 130
2 120
3 140
3 160
3 125
4 120
4 135
4 130
;
run;
proc sql;
create table temp2 as
select b.*
from(

select count(id) as count
,id
from temp
group by id
having count(id)=1
) as a
join temp as b
on a.id=b.id;
quit;
Flip
Fluorite | Level 6
proc sort;
by id bld_pres;
run;

data new;
set old;
by id bld_pres;
if first.id and last.id;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 559 views
  • 0 likes
  • 3 in conversation