🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 02-14-2019 07:57 PM
(1004 views)
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 |
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you can get the report but need to add formatting, use PROC FORMAT first:
proc format;
value sex 1='Male' 2='Female';
run;
Then within the procedure that generates the report apply the format:
format gender sex.;
proc format;
value sex 1='Male' 2='Female';
run;
Then within the procedure that generates the report apply the format:
format gender sex.;
5 REPLIES 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
PROC MEANS or PROC TABULATE would be where I would start.
Cynthia
PROC MEANS or PROC TABULATE would be where I would start.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I know the proc means work. But it will not give me name like male and female. rather it will say mean for 1 and mean for 2. I want the result as the example given
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
Not true. Procedures will give you formatted values for Male and Female, etc. You just need a user-defined format such as we show in Programming 1.
Cynthia
Not true. Procedures will give you formatted values for Male and Female, etc. You just need a user-defined format such as we show in Programming 1.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you can get the report but need to add formatting, use PROC FORMAT first:
proc format;
value sex 1='Male' 2='Female';
run;
Then within the procedure that generates the report apply the format:
format gender sex.;
proc format;
value sex 1='Male' 2='Female';
run;
Then within the procedure that generates the report apply the format:
format gender sex.;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You claimed that you know how to do this, getting stats for 1 and 2 instead of Male and female. Post your program and I will show how to modify it to get the report that you want.