```Date: Wed, 24 May 2006 16:22:01 -0400 Reply-To: Peter Crawford Sender: "SAS(r) Discussion" From: Peter Crawford Subject: Re: AN URGENT PROC TABULATE QUESTION The only way I get the original layout is when a '*' is missing in the table statement. * but first, generate some test data ; data demo1 ; do age = 1 to 100 by ranuni(1) *5 ; output ; end ; stop ; run ; *now the tabulate code that gives the error ; Proc Tabulate Data = Demo1 missing; var age; table age = 'Age' * (n = 'N' * f =8. mean = 'Mean' * f = 5.1 std= 'Standard Deviation' * f = 5.1 min = 'Min' * f = 3. Max = 'Max' f = 3.), ALL = 'Total'; Title2 'Tbale Demo5'; Run; * now insert a * between 'Max' and f = 3. ; * in preferred layout (to clarify table structure & purpose); Proc Tabulate Data= Demo1 missing ; var age ; table age='Age' * ( n='N' * f = 8. mean='Mean' * f = 5.1 std='Standard Deviation' * f = 5.1 min='Min' * f = 3. Max='Max' * f = 3. ) /*missed * more obvious in good layout */ , ALL='Total'; Title2 'Tbale Demo5'; Run; That the original table structure worked at all, is a tribute to how little we understand the sophistiation and resilience of PROC TABULATE. With that * missing, it assumed MAX had no format, and you want another column with format= 3. With a format but no statistic defined, the default applies. When an analysis var is present in the table crossing, the default statistic is sum. It is a surprise but somehow logical ! Peter C On Wed, 24 May 2006 11:25:41 -0800, David Neal wrote: >Just try to clean up your spacing. You don't want the spaces after >your variables and the * >Try: > >Proc Tabulate Data = Demo1 missing; >var age; >table age='Age'*(n='N'*f=8. mean='Mean'*f = 5.1 std='Standard >Deviation'*f=5.1 > min='Min'*f=3. Max='Max'*f=3.), > ALL='Total'; >Title2 'Tbale Demo5'; >Run; > >I basically just pulled all your spaces out. Sure, some of them could >have been there but it is easier for me to remember how the tabulate >statement works if I pull them all. > >David Neal > > > >RATHINDRONATH wrote: >> I am trying write Proc tabulate codes as follows: >> >> >> Proc Tabulate Data = Demo1 missing; >> >> var age; >> table age = 'Age' * (n = 'N' * f =8. mean = 'Mean' * f = 5.1 std >> = 'Standard Deviation' * f = 5.1 >> min = 'Min' * f = 3. Max = 'Max' f = 3.), >> ALL = 'Total'; >> Title2 'Tbale Demo5'; >> Run; >> >> >> I am having the following output: >> >> >> ---------------------------------------------- >> | | Total | >> |-------------------------------+------------| >> |Age |Sum |N | 60| >> | | |-----------+------------| >> | | |Mean | 63.0| >> | | |-----------+------------| >> | | |Standard | | >> | | |Deviation | 13.0| >> | | |-----------+------------| >> | | |Min | 29| >> | | |-----------+------------| >> | | |Max | 88.00| >> | ----------------------|------------| >> | | 3777| >> ---------------------------------------------- >> >> >> If you look at the botton you will see a number " 3777 " . What is that? >> And why >> I am having blocks for Sum ? I do not need 3777 and SUM box. >> Can anyone please get a look at the column and row dimension and let me know >> what mistake I just made? >> >> >> AN URGENT PROC TABULATE QUESTION >> ```

Back to: Top of message | Previous page | Main SAS-L page