Lets say we have 3 variables (var1, var2, var3)
All are categorical
var3 values could be one of 4: North, South, East, West
I want to do a certain procedure, let us say
Proc Freq data=have;
Tables Var1*Var2/chisq;
run;
And I want this to be repeated automatically for all the subgroups in Var3
Is there a simple way of doing it?
Best wishes for the New Year
By statement. I defer you to this link: Example 3.3 "Chi-Square Goodness-of-Fit Tests", Base SAS(R) 9.2 Procedures Guide: Statistical Proced...
By statement. I defer you to this link: Example 3.3 "Chi-Square Goodness-of-Fit Tests", Base SAS(R) 9.2 Procedures Guide: Statistical Proced...
Thanks, i did try the BY statement, but didnt notice I had to sort the data first
BW
You might also try:
proc freq data=have;
tables Var3*Var1*Var2/<insert keywords here>;
run;
The advantage here is that if you specify CMH as a keyword that you will get, in addition to the tests and tables for each level of Var3, a stratified analysis over all levels of Var3.
Steve Denham
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: