Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have data in the following format:
ID | A | B | C | D | E | F |
1 | 1 | 1 | 0 | 0 | 1 | 0 |
2 | 0 | 1 | 0 | 1 | 0 | 0 |
3 | 0 | 0 | 1 | 0 | 1 | 1 |
4 | 1 | 0 | 0 | 1 | 1 | 1 |
5 | 0 | 1 | 0 | 0 | 0 | 0 |
6 | 1 | 0 | 1 | 0 | 0 | 0 |
I want to display it as:
A | B | C | |
D | |||
E | |||
F |
|
where the blank space will contain count IDs as:
blank space between A and D will contain count of IDs with A=1 and D=1, and so on.
I tried using inline table with expression; but no success!
Could you please give me some direction to work on this?
Thanks!
Just use:
t0: load * inline [
ID A B C D E F
1 1 1 0 0 1 0
2 0 1 0 1 0 0
3 0 0 1 0 1 1
4 1 0 0 1 1 1
5 0 1 0 0 0 0
6 1 0 1 0 0 0
] (txt, delimiter is \t);
t1: crosstable(cat1, val1, 1) load ID, A, B, C resident t0;
t2: crosstable(cat2, val2, 1) load ID, D, E, F resident t0;
t3: noconcatenate load * resident t1; left join(t3) load * resident t2;
drop tables t0, t1, t2;
- Marcus
A | B | C | |
D | 1 | 1 | 0 |
E | 2 | 1 | 1 |
F | 1 | 0 | 1 |
for cell 00(cell DA), the expression will be: count({<A={1},D={1}>}ID)
for cell 01(cell DB), the expression will be: count({<A={1},D={1}>}ID) and so on..
Thanks!
Just use:
t0: load * inline [
ID A B C D E F
1 1 1 0 0 1 0
2 0 1 0 1 0 0
3 0 0 1 0 1 1
4 1 0 0 1 1 1
5 0 1 0 0 0 0
6 1 0 1 0 0 0
] (txt, delimiter is \t);
t1: crosstable(cat1, val1, 1) load ID, A, B, C resident t0;
t2: crosstable(cat2, val2, 1) load ID, D, E, F resident t0;
t3: noconcatenate load * resident t1; left join(t3) load * resident t2;
drop tables t0, t1, t2;
- Marcus
Thank you Marcus for the help!