BookmarkSubscribeRSS Feed
mandan414
Fluorite | Level 6
Hi Reeza,
But first I have to create this Var_4 (as total task) from those 3 of individual tasks.
Reeza
Super User
This is why I'd like to see the final results expected first.
mandan414
Fluorite | Level 6
Sorry, it seems it's confusing now. Let's start from beginning:
I have actually 5 variables that I want to put together. they are something like this as I mentioned before:
Var_1 who does the cleaning?
content: code
Myself 1
spouse 2
both 3
NA 6
NS 9

Var_2 who does the washing?
content: code
Myself 1
spouse 2
both 3
NA 6
NS 9

Var_2 who does the cooking?
content: code
Myself 1
spouse 2
both 3
NA 6
NS 9

Var_3 who does the caregiving?
content: code
Myself 1
spouse 2
both 3
NA 6
NS 9

Var_1 who does the teaching?
content: code
Myself 1
spouse 2
both 3
NA 6
NS 9
Let's say that I cannot disaggregate the data for sex due to confidentiality. Instead, I can combine all variables together as the total task and then compute how many percent of male vs female respond myself vs spouse vs both . But, I cannot simply sum up the contents because a respondent could reply myself for one variable, then spouse for another one and …… what I want to have at the end is a derived variable of total task from those 5 variables. Then I can do: proc freq data=my data; tables sex*total task; run; , and I will have the rate of total task for each sex. I need this by tomorrow and none of my codes seem work well. Thank you!
Reeza
Super User

1. Transpose your data set so you have a long data set and each chore/activity is on it's own line instead of in separate variables. PROC TRANSPOSE will do that.
2. Use PROC TABULATE to calculate summaries and percentages as desired.

If you'd like help to code that, please provide expected input and output as text data.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 18 replies
  • 1413 views
  • 1 like
  • 5 in conversation