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

Hi. 

I wonder how I can choose Phoneme_stress condition of 0 and 1 and drop 2, 3, 4, and 5.

Neither of below codes worked.

Could you please help me following codes?

 

data a1.prediss1;
set a1.prediss;
where Error=0 And [Phoneme_stress=0 or Phonem_stress=1];
run;


data a1.Prediss1;
set a1.Prediss;
if Phonem_stress in (2, 3, 4, 5) then delete;
where error=0;
run;

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Either of these changes should work:

 

data a1.prediss1;
set a1.prediss;
where Error=0 And (Phoneme_stress in (0, 1));
run;


data a1.Prediss1;
set a1.Prediss;
if Phonem_stress in (2, 3, 4, 5)  and error ne 0 then delete;
run;

 

View solution in original post

6 REPLIES 6
Reeza
Super User

Either of these changes should work:

 

data a1.prediss1;
set a1.prediss;
where Error=0 And (Phoneme_stress in (0, 1));
run;


data a1.Prediss1;
set a1.Prediss;
if Phonem_stress in (2, 3, 4, 5)  and error ne 0 then delete;
run;

 

nlpurumi
Obsidian | Level 7

Thank you.

Astounding
PROC Star

Your second program might be fine as is ... as long as you are spelling the variable name correctly.  Is it Phoneme_stress, or is it Phonem_stress?

 

Also, you never explained ERROR and what that is about.  So all we can do is assume you have used it correctly.

nlpurumi
Obsidian | Level 7

I wanted to included only error=0 values in all those conditions I wanted to include (phoneme_stress=0 or 1).

 

Does it change any of the codes I created or received from Reeza?

 

Astounding
PROC Star

It doesn't change either of @Reeza's programs.  You might want to select one or the  other, based on how you want bad data to be handled.  What should happen of Phoneme_stress is missing, or 8, for example?

nlpurumi
Obsidian | Level 7

After exploring a little bit, I found following two codes worked.

 


data a1.prediss1;
set a1.prediss;
where Error=0 And (Phoneme_stress in (0, 1));
run;


data a1.Prediss1;
set a1.Prediss;
where error=0;
if Phoneme_stress in (2, 3, 4, 5) then delete;
run;

 

I wanted to include only Error=0. Error is a dichotomous variable.

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

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
  • 6 replies
  • 1872 views
  • 2 likes
  • 3 in conversation