I need frequency matrix of my data.
my data is having 3 question Q1 -- Q23 and and one variable is cluster
value of cluster is 1 to 3
and values of Q1--Q23 are 1 to 5
i am using code below:
proc freq data=out_3 ;
table (Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18 Q19 Q20 Q21 Q22 Q23)*cluster
/nocol norow nocum nopercent;
Q23 CLUSTER COUNT PERCENT
1 1 68 0.3046322014
1 2 698 3.1269599498
1 3 3310 14.828420392
2 1 213 0.9542155721
2 2 2114 9.4704775558
2 3 3598 16.118627363
3 1 1323 5.9268882717
3 2 4657 20.862825912
3 3 1015 4.5470835947
4 1 3314 14.846339934
4 2 1385 6.2046411612
4 3 42 0.1881551832
5 1 472 2.1145058686
5 2 103 0.4614281874
5 3 10 0.0447988531
Now problem is , i am getting output only for Q23 , but i am looking result for all Q1--23 .
Is it possible to get that.
Thanks in advance
Could you please supply some test data in a data step (w/ cards) so we have something to chew on?
PS you added "nopercent" for the tables, yet your example output shows a percent column.
Are you sure this is the output of your code?
Read the documentation. And I mean it.
Only the last table will end up in the output dataset. SAS works as documented in this case.
Try transposing your dataset, so that you can use question number as a by variable.
I guess you just need to read the documentation thoroughly
names an output data set that contains frequency or crosstabulation table counts and percentages. If more than one table request appears in the TABLES statement, the contents of the OUT= data set correspond to the last table request in the TABLES statement.
(Underline added by me)
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.