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

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 453 views
  • 1 like
  • 2 in conversation