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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 18 replies
  • 1462 views
  • 1 like
  • 5 in conversation