BookmarkSubscribeRSS Feed
anuli98
Calcite | Level 5

I have two different groups (for the purpose of this discussion, lets just say males vs. females) and I am trying to compare the number of missed days of school between the two groups. The problem is, in the data there are two separate variables for missed school days for the two groups (i.e. for males, the variable is missedschool_males and females, missedschool_females; there's a reason why there are separate variables in the dataset, but I won't go in to that). Obviously, the information is the same, I just need to combine the values into one general missed_days_school variable and determine group differences using this new variable. Can someone please help me to do this. Thanks.

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Several ways I can think of right off the bat, however probably the easiest:

data want;

     set have;

     missed_days_school=sum(missedschool_males,missedschool_females);

run;

You could do it by and if statement.  Or a rename.  Its your choice.

ballardw
Super User

Or create a temporary data set to analyze that issue:

data temp;

     set have;

     type='M'; DaysMissed=missedschool_males;output;

     type='F'; DaysMissed=missedschooo_females;output;

    keep type daysmissed;/* and any other identification variables of interest*/

run;

Then you can run tests on DaysMissed classed by type for t-tests, comparison of distributions whatever.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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