The SAS Output Delivery System and reporting techniques

Losing digits in ODS output with proc tabulate

Reply
Frequent Contributor
Posts: 131

Losing digits in ODS output with proc tabulate

[ Edited ]

proc format;                                    

   picture mypct /*(round) */                      

      /* low-high='00.0009%';   /*digit selectors '0009%' */ 

 low-99='00.0000%'

99 - high='100%';

run;

 

proc sql;

create table app_summary2 as

select LOAN_OFFICER,RACF_ID,sum(stp) as stp1, sum(ln_cnt) as ln,

sum(stp)/sum(ln_cnt)*100 as pct12 format=mypct.

from app_summary

group by LOAN_OFFICER,RACF_ID

;quit;

proc sort data= app_summary2;by loan_officer;run;

 

I use ODS Tagset excel

ODS TAGSETS.ExcelXP file="&ReportOut..xml" Path="&OutDir" style=&dors_style;

 

%CoverSheet(&ReportName,&pbd_date_key,&Version);

ODS TAGSETS.ExcelXP

   options(sheet_interval='none'

           default_column_width='8'

           sheet_name="Summary"

           center_horizontal="no"

             frozen_headers = "no"

           Orientation='Landscape'

           embedded_titles='Yes'

           fittopage="No"

           blackandwhite="No"

           Embedded_Footnotes='Yes'

              absolute_column_width='7'

           autofit_height="Yes");

 

 

Proc tabulate data=app_summary2 order= data format=10. S=[cellwidth=80];        

Class LOAN_OFFICER racf_id /missing;

Var stp1 pct12 ln;

Tables LOAN_OFFICER * racf_id =' ' all={label='Total' S=[background = lightblue cellwidth=80]} *[STYLE=[Font_Weight=bold]],

         all={ label='Apps Sent Summary'  S=[background = lightblue]} *[STYLE=[Font_Weight=light]]

           *(pct12 =''*mean ='Total % Sum of % Sent to Processing'  *f=mypct.

                stp1 =' '*sum='Sum of SENT_TO_PROC_BY_END_RPT_MO'

              ln=''*sum ='Sum of CT_LN_NBR' )     

           / box='Loan Officer and LO_RACF';

           keylabel n='';      

run;

 

 

 

pct12(Total % Sum of % Sent to Processing)  is the problem When it exports I loose 2 digits from the display. I get

Total % Sum of % Sent to Processing

Sum of SENT_TO_PROC_BY_END_RPT_MO

Sum of CT_LN_NBR

 

70.00%

14

20

 
 

61.90%

13

21

 

66.67%

8

12

 

I should be getting for digits such as

70.0050%

60.9012%

 

Super User
Posts: 17,829

Re: Losing digits in ODS output with proc tabulate

When formatting data for Excel you need to use TAGATTR to format your fields and you use Excel formats not SAS formats.

 

Frequent Contributor
Posts: 131

Re: Losing digits in ODS output with proc tabulate

Can you give an example?

Super User
Posts: 17,829

Re: Losing digits in ODS output with proc tabulate

You can find examples here:

http://www.sas.com/events/cm/867226/ExcelXPPaperIndex.pdf

 

Find the topic of interest in the first column and the last column tells you what paper and page has the example. If you look at the bottom of the file, there are links to each of the documents.

 

Excel Format is what you're looking for.

SAS Super FREQ
Posts: 8,743

Re: Losing digits in ODS output with proc tabulate

Ask a Question
Discussion stats
  • 4 replies
  • 140 views
  • 1 like
  • 3 in conversation