AE table with %'s

Reply
N/A
Posts: 0

AE table with %'s

Hi,
I want to create an AE table (pref in TABULATE) that shows the # with each AE and (here's the part I'm having problems with...) %'s of all subjects - even those who have any AE.
Any help?
Thanks
Mike
SAS Super FREQ
Posts: 8,642

Re: AE table with %'s

Hi:
Are you using PCTN, PCTSUM or any of the other percent-related statistics???
http://support.sas.com/kb/22/983.html

If you are, then you would need a Picture format to add a percent sign to the created number. Even those this example was for a SAS/Graph procedure, the picture format is what you would use:
http://support.sas.com/kb/24/877.html
[pre]
/* Create a format for the values of PERCENT. The PCTFMT. */
/* format rounds the percentage to no decimal places and */
/* adds a percent sign to the value. */

proc format;
picture pctfmt (round) 0-high='000%';
run;
[/pre]

Then, inside your TABULATE code, you'd have this (or have the format in the TABLE statement):
[pre]

/* The FORMAT statement applies the PCTFMT. */
/* to the values of PERCENT. */
format percent pctfmt.;
[/pre]

If you are asking how to calculate a percent with your own denominator, you'd have to look in the doc or papers for examples. You specify your own denominator within < and > operators on the TABLE statement. There are some examples in these papers:
http://www2.sas.com/proceedings/sugi30/127-30.pdf
http://www2.sas.com/proceedings/sugi30/258-30.pdf

cynthia
N/A
Posts: 0

Re: AE table with %'s

Thanks for the response,
The picture format is a good idea - I will use that (when I get the %'s working). I think specifying a denominator would work, but the var I would want as a denominator isn't (directly) included in the summary table. Here's an example of the type of data I have...

ID TEXT
1 text1
1 text2
1 text3
2 text1
3
4 text2

So the table should look like this...

Total N 4 (100%)
Text1 2 (50%)
Text2 2 (50%)
Text3 1 (25%)

When I use PCTN I get %'s based on total number of TextX instead of total ID.
Do you know how I could achieve this
Thanks
Mike
Contributor
Posts: 49

Re: AE table with %'s

Mike,

The only way (that I can think of) is to calculate the percentages in a data step prior to reporting. I really don't like proc tabulate and would rather use proc report but that's a personal preference.

The n (%) variable can be created as a character type (i.e. 2 (50%)) using whatever method you want and then just use proc report to print out the results.
N/A
Posts: 0

Re: AE table with %'s

a denominator can be an analysis variable.
You need an analysis variable that provides the required denominator at the crossing level where you report. The analysis var used as denominator does not need to appear anywhere else in the table (just in the data).

If you show a sample of data with the denominator value required, we'll be more help.

good luck

PeterC
N/A
Posts: 0

Re: AE table with %'s

I agree with LawrenceHD where he gets his data organized prior to reporting and when it really looks the way he wants it he use Proc Report to display it. That's the way I do to.
Post a Question
Discussion Stats
  • 5 replies
  • 493 views
  • 0 likes
  • 3 in conversation