BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ammarhm
Lapis Lazuli | Level 10

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

1 ACCEPTED SOLUTION
3 REPLIES 3
ammarhm
Lapis Lazuli | Level 10

Thanks, i did try the BY statement, but didnt notice I had to sort the data first

BW

SteveDenham
Jade | Level 19

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1016 views
  • 6 likes
  • 3 in conversation