Use the population data to obtain the proportions of the population in each category. For example, your population might have 10% Asian, 40% black, and 50% white.
Then use those numbers on the TESTP= option on the TABLES statement in PROC FREQ:
proc sort data=Have out=Sample;
by Race; /* assume values are Asian, Black, and White */
run;
proc freq data = Sample order=data;
tables Race / nocum chisq
/* If population proportions are for Asian, Black, and White */
testp=(0.1 0.40 0.5);
run;
Hi Rick,
I think I understand what you are saying, but when I look at that document, it shows two Chi-Square test,( one for each region). I am only wanting to do one Chi-Square test, based off two different groups. I have attached a document that shows the frequency of sex, Females and Males,in Case group, as well as the frequency of sex3, Females and Males, in Case3 group. Since they are in two different data sets, how would I code this?
*I will exclude the Unknown values before analysis, but I am more interested in how to set up the code right now
The two groups will need to be in the same data set, with an indicator variable that defines which group the observation belong to. That group variable would then appear on the TABLES statement.
So for example, if you wanted to test if the distribution of race across the two groups was the same, then you would have:
tables group*race/chisq;
What is the response variable here? I must have missed that Anyhow, if there is a date on every record, you can code in a flag based on the cutoff date. I think you can ignore observation ID in the PROC FREQ analysis. If you become interested in a more complex/complete approach, you might be able to use PROC GENMOD with a GEE model to test for the time segment equality/homogeneity.
SteveDenham
Hi Steve,
Thank you. Do you have any references or suggestions on how I code it based on the cutoff date?
There are probably 50 threads on how to do that, especially in the Programming forum. Search and you will find.
SteveDenham
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.
About cookies on this site
This site uses cookies and related technologies for site operation, analytics and third-party advertising purposes, as described in our SAS Privacy Statement. You may consent to our use of these technologies, reject non-essential technologies or further manage your preferences. To opt out of SAS making information relating to cookies and similar technologies available to third parties for advertising purposes, select "Required only." To exercise other rights you may have related to cookies, select "Manage cookies."