I´m struggling to graph occurrences of multiple variables in one graph. My data describes on which spinal level (spond_niv__x) patients (record_id) had surgery, it can be surgery on multiple levels (see below).
What I want is a graph that show the number/frequency of levels done surgery on. 5 bars in one graph, each bar representing the level (spond_niv__x) and showing the number of occurrences.
I tried to use "graph bar" and "catplot" but it shows 2 bars for each level (checked and unchecked), I only want the checked to appear. Perhaps I need to convert my data?
data is :
--------------------------------------------------------------------------------
record_id Record ID
--------------------------------------------------------------------------------
Type: Numeric (int)
Range: [1,131] Units: 1
Unique values: 131 Missing .: 0/131
--------------------------------------------------------------------------------
spond_niv___1 Spondylodese niveauer (choice=L1-L2)
--------------------------------------------------------------------------------
Type: Numeric (byte)
Label: spond_niv___1_
Range: [0,1] Units: 1
Unique values: 2 Missing .: 0/131
Tabulation: Freq. Numeric Label
129 0 Unchecked
2 1 Checked
--------------------------------------------------------------------------------
spond_niv___2 Spondylodese niveauer (choice=L2-L3)
--------------------------------------------------------------------------------
Type: Numeric (byte)
Label: spond_niv___2_
Range: [0,1] Units: 1
Unique values: 2 Missing .: 0/131
Tabulation: Freq. Numeric Label
124 0 Unchecked
7 1 Checked
--------------------------------------------------------------------------------
spond_niv___3 Spondylodese niveauer (choice=L3-L4)
--------------------------------------------------------------------------------
Type: Numeric (byte)
Label: spond_niv___3_
Range: [0,1] Units: 1
Unique values: 2 Missing .: 0/131
Tabulation: Freq. Numeric Label
101 0 Unchecked
30 1 Checked
--------------------------------------------------------------------------------
spond_niv___4 Spondylodese niveauer (choice=L4-L5)
--------------------------------------------------------------------------------
Type: Numeric (byte)
Label: spond_niv___4_
Range: [0,1] Units: 1
Unique values: 2 Missing .: 0/131
Tabulation: Freq. Numeric Label
82 0 Unchecked
49 1 Checked
--------------------------------------------------------------------------------
spond_niv___5 Spondylodese niveauer (choice=L5-S1)
--------------------------------------------------------------------------------
Type: Numeric (byte)
Label: spond_niv___5_
Range: [0,1] Units: 1
Unique values: 2 Missing .: 0/131
Tabulation: Freq. Numeric Label
97 0 Unchecked
34 1 Checked
What I want is a graph that show the number/frequency of levels done surgery on. 5 bars in one graph, each bar representing the level (spond_niv__x) and showing the number of occurrences.
I tried to use "graph bar" and "catplot" but it shows 2 bars for each level (checked and unchecked), I only want the checked to appear. Perhaps I need to convert my data?
data is :
--------------------------------------------------------------------------------
record_id Record ID
--------------------------------------------------------------------------------
Type: Numeric (int)
Range: [1,131] Units: 1
Unique values: 131 Missing .: 0/131
--------------------------------------------------------------------------------
spond_niv___1 Spondylodese niveauer (choice=L1-L2)
--------------------------------------------------------------------------------
Type: Numeric (byte)
Label: spond_niv___1_
Range: [0,1] Units: 1
Unique values: 2 Missing .: 0/131
Tabulation: Freq. Numeric Label
129 0 Unchecked
2 1 Checked
--------------------------------------------------------------------------------
spond_niv___2 Spondylodese niveauer (choice=L2-L3)
--------------------------------------------------------------------------------
Type: Numeric (byte)
Label: spond_niv___2_
Range: [0,1] Units: 1
Unique values: 2 Missing .: 0/131
Tabulation: Freq. Numeric Label
124 0 Unchecked
7 1 Checked
--------------------------------------------------------------------------------
spond_niv___3 Spondylodese niveauer (choice=L3-L4)
--------------------------------------------------------------------------------
Type: Numeric (byte)
Label: spond_niv___3_
Range: [0,1] Units: 1
Unique values: 2 Missing .: 0/131
Tabulation: Freq. Numeric Label
101 0 Unchecked
30 1 Checked
--------------------------------------------------------------------------------
spond_niv___4 Spondylodese niveauer (choice=L4-L5)
--------------------------------------------------------------------------------
Type: Numeric (byte)
Label: spond_niv___4_
Range: [0,1] Units: 1
Unique values: 2 Missing .: 0/131
Tabulation: Freq. Numeric Label
82 0 Unchecked
49 1 Checked
--------------------------------------------------------------------------------
spond_niv___5 Spondylodese niveauer (choice=L5-S1)
--------------------------------------------------------------------------------
Type: Numeric (byte)
Label: spond_niv___5_
Range: [0,1] Units: 1
Unique values: 2 Missing .: 0/131
Tabulation: Freq. Numeric Label
97 0 Unchecked
34 1 Checked

Comment