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

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

SAS Training: Just a Click Away

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

Browse our catalog!

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