I have a dataset and I need to run a proc-freq cross-tabulation (two-way frequency table) of one variable by all variables in the dataset.
Is there a way to do this without writing a step for each cross-tabulation? I have 70+ variables I need to run against sectorcollapsed.
proc freq data=cath.characterlabels;
table sectorcollapsed*location;
run; I used a by-step, which didn't give me the output I needed, as it did tables separately for each category of the by variable (So I have 70*4 tables, which I do not want)
I would like the output of each variable to look exactly similar to what the tables code would give for each cross-tabulation with the following:
| Location1 | Location2 | Location3 | Total | ||
| Sector1 | Frequency Percent Row Pct Col Pct | .... | .... | ||
| Sector2 | |||||
| Sector3 | |||||
(Count (n), Frequency(%), RowPct, ColPct, and then the total.
Any help would be greatly appreciated!
Simplest would be:
proc freq data=cath.characterlabels;
table sectorcollapsed* _all_;
run;
That will procude sectorcollapsed with itself but the code is easy to make. Not difficult to get all of the variable names but that gets into macro language coding and adds a layer of complexity not needed.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.