Hi,
how can I show this table vertically? and remove "N"?
EEOG |
EEOG | All | ||||
2 | 3 | 5 | 7 | 10 | |
N | N | N | N | N | N |
15 | 106 | 11 | 150 | 60 | 342 |
this is my code:
PROC TABULATE DATA=Employee.Sheet1;
CLASS EEOG PRI;
TABLE EEOG ALL;
RUN;
Thanks,
Nazanin
my data is in Excel.
something like this:
PRI | EEOG |
1 | 7 |
2 | 3 |
3 | 7 |
4 | 3 |
5 | 7 |
6 | 7 |
7 | 7 |
8 | 7 |
9 | 7 |
This may do what you want:
PROC TABULATE DATA=Employee.Sheet1; CLASS EEOG PRI; TABLE EEOG ALL , n=' '; RUN;
You were getting a row because you did not provide a column expression. The page, row and column expressions are separated by a comma. If there are two expressions the first is the ROW and the second is the column. If you have three expressions then they are page, row and column.
The n is the default statistic. Using n=' ' says to show a blank for the heading for that statistic. You could use other text such as "Count" if you like.
perfect!
I got the result I wanted.
Thanks,
If your working on SAS Enterprise Guide then play with Task>Describe>Summary Table (Which is Proc Tabulate) point-and-click feature.
It will create the code and you can copy and edit the code further.
Thanks,
my DB is this:
PRI | EEOG | PWD |
1 | 7 | |
2 | 3 | DIS |
3 | 7 | |
4 | 3 | |
5 | 2 | |
6 | 7 | |
7 | 7 | |
8 | 10 | |
9 | 7 | |
10 | 3 | |
11 | 7 |
however, I want to generate the following table:
EEOG | Count | PWD | LMA | Expectation | Gap |
2 | 1 | 0 | LMA | LMA*Count | Expectation-Count |
3 | 3 | 1 | LMA | LMA*Count | Expectation-Count |
5 | 0 | 0 | LMA | LMA*Count | Expectation-Count |
7 | 6 | 0 | LMA | LMA*Count | Expectation-Count |
10 | 1 | 0 | LMA | LMA*Count | Expectation-Count |
11 | 1 |
What is the logic for those last columns? Not seeing any reference to LMA anywhere else.
That looks somewhat like a PROC FREQ depending on your definition of 'Expected' and LMA.
@NazaninSAS wrote:
Thanks,
my DB is this:
PRI
EEOG
PWD
1
7
2
3
DIS
3
7
4
3
5
2
6
7
7
7
8
10
9
7
10
3
11
7
however, I want to generate the following table:
EEOG
Count
PWD
LMA
Expectation
Gap
2
1
0
LMA
LMA*Count
Expectation-Count
3
3
1
LMA
LMA*Count
Expectation-Count
5
0
0
LMA
LMA*Count
Expectation-Count
7
6
0
LMA
LMA*Count
Expectation-Count
10
1
0
LMA
LMA*Count
Expectation-Count
11
1
LMA is constant, I have to assign it later.
You could get the same wanted result with:
proc freq data=employee.sheet1 ;
table eeog / norow nocol;
run;
Thanks,
but I want to see the total as well!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.