I am struggling with coding with following questions:
I need to find difference between male and female from dataset and find significance between male and female.
First, should I subset or split dataset?
There are variables for each male and female so I think I need to create a new variable with add number of variables.
What is a code to get significance between male and female?
Please help me,
Hi,
You shouldn't need to split your dataset, SAS does by group processing so just use gender as a by or class variable. E.g.
proc sort data=sashelp.classfit out=tmp;
by sex;
run;
proc means data=tmp noprint;
var age;
by sex;
output out=myres n=n mean=mean stddev=stddev min=min max=max;
run;
This will give you means results by sex from the sashelp table.
As for significance, not sure, your best off posting that question in Statistical Procedures sub forum.
is correct -- no need to split the data. However, one improvement on this answer: you don't need to use BY groups or SORT the data first with PROC MEANS. You can use the CLASS statement instead:
Result:
The first record is the stats for ALL observations, and the next two records are for F and M, respectively.
Chris
If you only need to analyze one variable, you could get everything you want by running proc ttest. e.g.:
proc ttest data=sashelp.class;
class sex;
var weight;
run;
... IF (big if) your data has a normal distribution. Otherwise, or instead, since there is not is not much power lost, go for non-parametric analyses :
proc npar1way data=sashelp.class Wilcoxon;
class sex;
var weight;
exact Wilcoxon;
run;
PG
IF you have more than two levels, Don't forget to use variance analysis .
proc glm
proc anova
Xia
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!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.