BookmarkSubscribeRSS Feed
NazaninSAS
Quartz | Level 8

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

 

 

 

10 REPLIES 10
Reeza
Super User
How is your data structured?
NazaninSAS
Quartz | Level 8

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

ballardw
Super User

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.

NazaninSAS
Quartz | Level 8

perfect!

 

I got the result I wanted.

 

Thanks,

SuryaKiran
Meteorite | Level 14

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,
Suryakiran
NazaninSAS
Quartz | Level 8

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

   
Reeza
Super User

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

     

 

NazaninSAS
Quartz | Level 8

LMA is constant, I have to assign it later.

Shmuel
Garnet | Level 18

You could get the same wanted result with:

proc freq data=employee.sheet1 ;
    table eeog / norow nocol;
run;
NazaninSAS
Quartz | Level 8

Thanks,

 

but I want to see the total as well!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 2145 views
  • 1 like
  • 5 in conversation