Hi,
I have two variables. Gender (male, female) and Level (High, Medium, Low)
Male =1
Female =2
High=1
Medium=2
Low=3
My final data set example
| Value | Gender | Level |
| 10 | 1 | 1 |
| 5 | 1 | 1 |
| 6 | 1 | 1 |
| 2 | 1 | 1 |
| 8 | 1 | 2 |
| 9 | 1 | 2 |
| 10 | 2 | 2 |
| 10 | 2 | 2 |
| 8 | 2 | 3 |
| 6 | 2 | 3 |
| 4 | 2 | 3 |
| 12 | 2 | 3 |
Now I want descriptive statistics and univariate regression from the above data set in the following way. What would be sas code? Please help. The following is just an example not the actual answer of the above
| Level | Mean | Std. dev | |
| Male | High | 8.00 | 2.828 |
| Medium | 10.00 | 2.828 | |
| Low | 8.83 | 2.563 | |
| Total | 8.94 | 2.711 | |
| Female | High | 9.00 | 2.828 |
| Medium | 8.00 | 3.033 | |
| Low | 14.17 | 3.312 | |
| Total | 10.39 | 4.002 | |
| Total | High | 8.50 | 2.747 |
| Medium | 9.00 | 2.985 | |
| Low | 11.50 | 3.966 | |
| Total | 9.67 | 3.448 |
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.
Ready to level-up your skills? Choose your own adventure.