Pyrite | Level 9

## Subcatagory

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
PROC Star

## Re: Subcatagory

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.;
5 REPLIES 5
SAS Super FREQ

## Re: Subcatagory

Hi:
PROC MEANS or PROC TABULATE would be where I would start.
Cynthia
Pyrite | Level 9

## Re: Subcatagory

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
SAS Super FREQ

## Re: Subcatagory

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
PROC Star

## Re: Subcatagory

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 Star

## Re: Subcatagory

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.
Discussion stats
• 5 replies
• 827 views
• 1 like
• 3 in conversation