BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
statsgal
Calcite | Level 5

I have a dataset from a longitudinal study where we collected data by waves. I want to create a new table. I want to keep participants (who are organized by id) who answered all questions (labeled a, b, c, and d) for at least one wave. This was my previous code:

proc sql;
	create table only as select * from full group by id having 
		not (a eq . and b eq . and c eq . and d eq .)
		order by id, wave;
quit;

However, with this code, I filter by keeping participants who answered any of these questions by at least one wave. . How can I go about fixing this?

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Try this:

 

proc sql;
	create table only as 
	select * from full 
	where id in (
		select id
		from full 
		where cmiss(a, b, c, d) = 0 )
	order by id, wave;
quit;
PG

View solution in original post

1 REPLY 1
PGStats
Opal | Level 21

Try this:

 

proc sql;
	create table only as 
	select * from full 
	where id in (
		select id
		from full 
		where cmiss(a, b, c, d) = 0 )
	order by id, wave;
quit;
PG

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 628 views
  • 1 like
  • 2 in conversation