|
On Sun, 5 Nov 2006 17:39:25 -0800, xxu8810152@GMAIL.COM wrote:
>Hello all,
>
>I have two questions in using proc print and ODS. My code is like this,
>
>_______________________________________________
>data test;
> input business_line $ x $ y z year month amount;
>datalines;
>Jan a 1 3 2006 6 20000
>Feb g 6 7 2006 6 56800
>Mar b 3 5 2006 6 78090
>;
>
>proc sort data = test;
> by business_line;
>run;
>
>title1 "All business line";
>options nobyline;
>title2 "#byval(business_line) test";
>proc print data = test;
> by business_line;
>run;
>
>ods tagsets.excelxp file = "C:\test.xls" style = sasweb;
>proc print data = test;
> var amount;
> format amount comma10.;
>run;
>ods tagsets.excelxp close;
>____________________________________________________________
>
>For the first question, when the monthly results are printed, I prefer
>it looks
>
>business_line
>Jan
>...
>
>
>Feb
>.....
>
>
>Mar
>......
>
>Instead of
>
>business_line
>Jan
>....
>
>
>business_line
>Feb
>......
>
>
>business_line
>Mar
>......
>
>
>In other words, I only need to print the first line of the title once,
>instead of repeating it every
>time. Does anyone know how to set the options?
I don't think you can do this with PROC PRINT and TITLE alone. Here's a
technique utilizing a view:
data printview(drop=blnum) / view=printview;
set test;
by business_line;
blnum + first.business_line;
if blnum=1 then just_once = "All business line";
run;
title1 "#byval(just_once)";
title2 "#byval(business_line) test";
proc print data = printview;
by descending just_once business_line;
run;
>
>For the second question, it is related to ODS. As shown in the second
>part of the above code, I would like to use ODS excelxp tagsets to
>generate an Excel file and would like to get one of the variables in
>comma format like shown above, but the code does not create comma. For
>example, for a variable with value of 3000, I like it to be displayed
>as 3,000, but the above code still outputs it like 3000 without the
>comma.
>I saw an example close to what I want
>var amount / style={tagattr='format:Currency'} ;
>that can create dollar sign for currency, but I don't know how to write
>one to create comma.
>
>Thank you!!!
|