Help using Base SAS procedures

proc tabulate formatting and computation

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

proc tabulate formatting and computation

Hey all,

So I would like to get rid of or edit the border at the top of my proc tabulate tables. It is only a problem when their is a variable to page break on.

also I would like to add a simple subtraction computation for example income1-income2 =difference.

Thanks

Here is an image:

Note the ugly bordering that is only on the page lable. It is make my template look horrible. Thanks

Martinez


Accepted Solutions
Solution
‎08-08-2013 12:46 PM
SAS Super FREQ
Posts: 8,869

Re: proc tabulate formatting and computation

Posted in reply to Martinez77

Hi:

  Seeing all of your code and understanding your ODS destination will be important information for anyone to help you.

  However, you also have a different challenge. You said that

"I would like to add a simple subtraction computation for example income1-income2 =difference"   However, only PROC REPORT has a COMPUTE block which allows you to perform computations such as you describe. PROC REPORT can produce the same set of statistics as TABULATE, except for a few, so depending on your desired statistics, you should be able to switch to PROC REPORT fairly easily.

  But, again, seeing ALL of your code and knowing your destination would make it easier for someone to point you to a solution. It looks like you are getting simple counts. So it should not be hard to move to REPORT. Depending on your destination, if you do NOT need to compute a new column, then you might want to work with Tech Support on your border issue. It might be a problem with your code or your destination.

cynthia

View solution in original post


All Replies
Solution
‎08-08-2013 12:46 PM
SAS Super FREQ
Posts: 8,869

Re: proc tabulate formatting and computation

Posted in reply to Martinez77

Hi:

  Seeing all of your code and understanding your ODS destination will be important information for anyone to help you.

  However, you also have a different challenge. You said that

"I would like to add a simple subtraction computation for example income1-income2 =difference"   However, only PROC REPORT has a COMPUTE block which allows you to perform computations such as you describe. PROC REPORT can produce the same set of statistics as TABULATE, except for a few, so depending on your desired statistics, you should be able to switch to PROC REPORT fairly easily.

  But, again, seeing ALL of your code and knowing your destination would make it easier for someone to point you to a solution. It looks like you are getting simple counts. So it should not be hard to move to REPORT. Depending on your destination, if you do NOT need to compute a new column, then you might want to work with Tech Support on your border issue. It might be a problem with your code or your destination.

cynthia

Contributor
Posts: 27

Re: proc tabulate formatting and computation

Posted in reply to Cynthia_sas

Cynthia,

Yes I figured out the ods issue. I just added the / box =_page_ and it resolved the problem for now.

As far as proc report goes I have never used it. Could you show me some example code of proc report that would reflect a proc tabulate output.

My boss just asked me about it recently so still waiting to hear back from him on specific variables.

I guess and example would be income1 -income2 =difference all showing in columns

Thank you,

Martinez

Contributor
Posts: 27

Re: proc tabulate formatting and computation

Posted in reply to Cynthia_sas

Cynthia,

This is the simple code that is trying to be executed after bringing in a data set.

I hope this helps clarify

Proc tabulate data=simsterm;

CLASS GENDER

VAR CUM_GPA CUR_GPA;

TABLE GENDER, CUM_GPA CUR_GPA DIFF=(CUM_GPA – CUR_GPA);

RUN;


Thanks

SAS Super FREQ
Posts: 8,869

Re: proc tabulate formatting and computation

Posted in reply to Martinez77

Hi:

  Your code: DIFF=(CUM_GPA-CUR_GPA) is not valid TABULATE syntax. So that is not going to work. In addition, you referred to BOX=_PAGE_, which indicates a 3 dimensional table, but in your posted code, you only have ROW and COL dimensions, you don't have a PAGE dimension. So are you asking about a different TABULATE than you originally posted?

  Also, I don't see any specification for TOTAL, such as you showed in your original screen shot. Do you have ANY working code with TABULATE? for the GPA example? Where is your BOX=_PAGE_ code? You also did not say what you were using for your destination of interest - -is it HTML, RTF, PDF???? What is your complete ODS statement?

  In addition, with this new TABULATE that you show, you will get the SUM statistic by default for CUR_GPA and CUM_GPA -- is that what you want? The sum of all these values for each gender???? Or do you want the average??? Have you pre-computed the CUR and CUM values?

  You asked for some sample PROC REPORT code. There are a lot of examples in the doc and in previous forum postings. Without seeing your data and your WORKING code (you also need a semi-colon at the end of your CLASS statement for this newly posted code to work) for this new example, it's hard to come up with a specific example.

cynthia

Contributor
Posts: 27

Re: proc tabulate formatting and computation

Posted in reply to Cynthia_sas

Cynthia,

You gave me enough information to read and figure it out via research.

Thank you so much,

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 236 views
  • 0 likes
  • 2 in conversation