I have 2 variables that have values that range from 1 to 5. I want to create a table that simply lists the variable names across the top, each value down the side (basically a category label) and then the column percentages under each variable for each value. This should be pretty simple but I can't figure out how to do it. I tried Proc Tabulate but it keeps asking for another dimiension. Any help is appreciated. The output table would look something like this:
Not exactly. To further explain, I have 500 observations. The values of var1 and var2 range from 1 to 5. 18% of the values in var1 (n = 90) have a value of 1, 10% (n=50) have a value of 2, etc. If I used proc freq, I would get 2 separate tables that display the value 1 to 5 and the associated counts and percentages with each value. I just want to be able to display the same output from proc freq (percetnages or counts) but for 2 or more variables at the same time in the same table.
If the data are in a slightly different structure, then you can use TABULATE. The program below is based on the previous scenario for the data. With a TYPE variable and a VAL variable, you can get TABULATE to calculate the COLPCTN statistic automatically.