The SAS Output Delivery System and reporting techniques

Proc Tabulate

Reply
Occasional Contributor
Posts: 5

Proc Tabulate

Hi Team,

Iam using Proc Report for creating a table. I have created a small dataset. i have 4 levels of a variable (L,P,S,W) and then sub_types within each level

O,V,U

the desired output is attached. Iam trying to find frequencies of only the 1's, Iam not interested in the 0's

Also, is there a way to output the data in a desired fashion, for eg.,

i want par6, par7 and part8 to be followed by part1 etc.,

 

Thank you,

 

Super User
Posts: 17,831

Re: Proc Tabulate

You should post some sample data in addition. Also, please don't double post your question to multiple forums.

You won't get a dataset in that fashion, but you will get output displayed in that manner. Please clarify which is your desired output, I'm assuming the display since you can't have multiple headers for variables.
Occasional Contributor
Posts: 5

Re: Proc Tabulate

Hi Reeza,

I created a dataset and an output but i was not able to post 2 spreadsheets. i have the dataset and the output in one spreadsheet in different tabs. Hopefully this should give us a better picture. 

Thank You.

Super User
Posts: 5,083

Re: Proc Tabulate

When you have a variable that is always 0 or 1, change the approach.  To get a single statistic per variable:

 

To get the frequencies of the "1" values, get the sum.

 

To get the percentage of "1" values, get the mean.

 

You may have to adjust your computations, if your variable could take on other values, such as a missing value.

 

Good luck.

Occasional Contributor
Posts: 5

Re: Proc Tabulate

Thank You very much.

Super User
Posts: 17,831

Re: Proc Tabulate

1. As mentioned, when you have 0/1 you can sum
2.To control order you need to create a variable that corresponds to the order and then use that to control the order.
3. You didn't answer the question - do you need this as output or a dataset?
Occasional Contributor
Posts: 5

Re: Proc Tabulate

hi Reeza,

i think i figured it out, i ran a means within the table statement. 

 

Thank you

 

 

proc tabulate data = test out = test1; by procedure1;

var par1 par2....;

class type sub_type;

table all*n (par1 par2 ) *mean = '' *f=pct100fmt.

, type = '' * sub_type= ''  /nocellmerge;

run;

 

Super User
Posts: 17,831

Re: Proc Tabulate

Yay! Glad to see it worked for you Smiley Happy
Ask a Question
Discussion stats
  • 7 replies
  • 931 views
  • 0 likes
  • 3 in conversation