Hi
When using ods output, a _TABLE_ variable is generated. However, I cannot figure out when the value is different from 1.
I was thinking that there could be a link with the TABLE variable but it does not seem the case.
Here is an example :
data abcd;
a=1; b=1; c=1; d=1; output;
a=2; b=1; c=0; d=4; output;
a=2; b=1; c=0; d=4; output;
a=1; b=1; c=1; d=1; output;
a=1; b=1; c=1; d=1; output;
ods output CrossTabFreqs=demo;
proc freq data=abcd ;
table a*b a*c;
run;
proc print data=demo noobs;
run;
ods output CrossTabFreqs=demo;
proc freq data=abcd ;
table a*b*c;
run;
proc print data=demo noobs;
run;
ods output CrossTabFreqs=demo;
proc freq data=abcd ;
table a*b*c;
run;
proc print data=demo noobs;
run;
To go along with @Reeza example, look in the results window.
Notice that for a*b and a*c there is only one table each but for a*b*c there are multiple tables?
If you look in the results window you will see in each table something like "Table 1 of b by c" and "Controlling for a=1".
So each of the tables in the gets a number greater than one when there are more levels of the "controlling for"
Consider:
data abcd; input a b c d; datalines; 1 1 1 1 2 1 0 4 2 2 0 4 1 1 1 1 1 1 1 1 3 2 1 1 3 2 0 0 3 1 1 4 3 2 1 4 ; ods output CrossTabFreqs=demo; proc freq data=abcd ; table a*b*c; run;
There are 3 levels of variable A now, so there are 3 "controling for" of table for the b*c
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.