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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 818 views
  • 2 likes
  • 3 in conversation