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

Hi All,

 

I hope this message finds you well. I was wondering if there is any way to select participants who answered the cesd question more than once. Thanks!

 

ID cesd1 cesd2 cesd3 cesd4 cesd5  
1 . 0 . 1 2 keep
2 . . . . 5 delete
3 1 . . . . delete
4 . 1 . 2 . keep
5 0 2 1 2 4 keep
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Assuming the variables are numeric you can use the N() function to see how many non-missing values there are.

data want;
  set have;
  if n(of cesd1-cesd5)<2 then delete;
run;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

Assuming the variables are numeric you can use the N() function to see how many non-missing values there are.

data want;
  set have;
  if n(of cesd1-cesd5)<2 then delete;
run;
nwang5
Obsidian | Level 7
Thanks for your quick response! You are so nice. Thank you very much!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 399 views
  • 1 like
  • 2 in conversation