[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: how to keep SAS format using exceltag in proc tabulate
From:       Yu Zhang <zhangyu05 () GMAIL ! COM>
Date:       2012-06-27 17:13:24
Message-ID: CAOVa6wrhs=rtjBGHQRF6CnXC-E7JqoAkL6_tRJf6WSgfhxaMgg () mail ! gmail ! com
[Download RAW message or body]

Hello, Bin,

based on my limited experience with ExcelXP tagset, TAGATTR is what you are
looking for. please see below,

ods tagsets.ExcelXP path="c:\temp"
file="TEST.xls";
proc tabulate data=sashelp.bweight out=out;
  class ed;
  var smoke;
     tables ed='', smoke*(sum='N'*f=5.
mean='%'*f=best.*[style=[tagattr='format:##.0%']])
        all='Total'
     / box='Education';
run;
ods _all_ close;
ods listing;

you still have to associate format with the MEAN statistic, otherwise,
rounding will occur. you can remove the F and observe what will happen.

HTH

Yu

On Wed, Jun 27, 2012 at 10:52 AM, Bin Zhu <bxz01@health.state.ny.us> wrote:

> Hello,
>
> I am running the following code:
>
> ods tagsets.ExcelXP path="c:\temp"
> file="TEST.xls";
> proc tabulate data=sashelp.bweight ;
>   class ed;
>   var smoke;
>      tables ed='', smoke*(sum='N'*f=5. mean='%'*f=percent8.1)
>         all='Total'
>      / box='Education';
> run;
> ods _all_ close;
> ods listing;
>
> The percent format is not kept in the final excel file. Could someone
> kindly point to how modify the code to get the desired output?
>
> Any suggestions will be appreciated.   Thanks.
>  Thanks.
>
> Bin
>
>
> **********************************************************************************
>
> * Please do not email patient names or other identifying information!    *
>
> **********************************************************************************
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic