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

Hello everyone this is what I am dealing with. 

aigiss_0-1675370790769.png

I have three variables Syphilis Gonorrhea chlamydia (dichotomous) in dataset called "combined_dataset." I want to combined those variables to create a new variable "STIs" based on premise of 'N' and 'Y'. However, when I input the code (see below), the numbers are not adding up for the variable 'STIs' for 'Y' observations (should be n=1193). Can someone help? 

data combined_dataset;
  set combined_dataset;
  length STIs $1;
  if Syphilis = "Y" or Gonorrhea = "Y" or Chlamydia = "Y" then STIs = "Y";
  else combined_variable = "N";
run;

 

aigiss_1-1675370977915.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
A person can have more than one disease at a time, so the most that Y should be is 1,193 but not what it should be. If you have more than one disease, you get counted only once in this summary.

View solution in original post

5 REPLIES 5
Reeza
Super User
It should not be 1193 because it's not a mutually exclusive criteria. If they don't have chlamydia it doesn't mean they don't have something else at all.
aigiss
Obsidian | Level 7

I fail to understand your explanation, I apologize can you clarify your answer? 

Reeza
Super User
A person can have more than one disease at a time, so the most that Y should be is 1,193 but not what it should be. If you have more than one disease, you get counted only once in this summary.
aigiss
Obsidian | Level 7

Ooooh. That is right. Duh! Thank you for the explanation. I need my cup of coffee. 

Reeza
Super User
No worries, I initially mixed up the Y/N in my explanation.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 5 replies
  • 572 views
  • 5 likes
  • 2 in conversation