Date: Thu, 7 Apr 2011 16:36:01 -0500
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: Proc Report, Across, style(column) tagattr
In-Reply-To: <B90B817A9BBB904AAAD7EC321C015967223E7F@USFCH-MAIL1.lewin.com>
Content-Type: text/plain; charset=ISO-8859-1
Thank you Ted for the translation.
On Thu, Apr 7, 2011 at 4:30 PM, Kirby, Ted <ted.kirby@lewin.com> wrote:
> I think data_null_ meant that you can NOT specify an enumerated list as
> indicated because the number must be at the end of the variable name.
> However, PROC REPORT is funny in that the default Column "names" that it
> creates are of the form _Cn_, where n is the column number. Thus you
> may need to explicitly include all of these column "names" in your ARRAY
> statement as in:
>
> ARRAY temp(2:6) _C2_ _C3_ _C4_ _C5_ _C6_;
>
> Or use a macro to write out the column names if you have more than a few
> columns to include in the array.
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Data _null_;
> Sent: Thursday, April 07, 2011 4:59 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Proc Report, Across, style(column) tagattr
>
> You can specify a enumerated list _C2_ - _C6_ because the number have to
> come at the end.
>
> Just list them individually or you might try _C:
>
> On Thu, Apr 7, 2011 at 3:52 PM, Sudo Ku <crafty876@hotmail.com> wrote:
>> Hi Yu:
>>
>> Thanks for the compute block, I would have been out in the woods on my
>
>> own especially with the array however I still must be doing something
>> right. I have 5 crop_yr varables 2005-2009 inclusive but when I run
>> the code I keep getting an error that tells me I have more varables
>> than assigned, I have tried adding more columns but this doesn't help.
>
>> There is also something odd about a numeric suffix in the array
>> statment and in my session of SAS the word array after compute dummy
>> is red. I'm not much of an array expert using the data step so it is
>> really baffling when it happens in the report proc... Thanks for the
>> additional help
>>
>> My logfile
>>
>> 13529 proc report data=OK.table_1 nowindows ;
>> 13530
>> 13531 title1 ' '; title2 "Table 1. Total grain and wheat flour exports
>
>> (metric tonnes)";
>> 13532
>> 13533 Columns grain_code (crop_yr, tonnes) dummy;
>> 13534
>> 13535 define grain_code / group " " format=$tab1_grain_e. order=data;
>> 13536 define crop_yr / across " " Format=crop_yr. order=data;
>> 13537 define tonnes / analysis Sum format=comma13. " "
>> 13538 style(Column)={tagattr='type:Number Format:#,##0'};
>> 13539 define dummy / computed noprint;
>> 13540
>> 13541
>> 13542 compute dummy;
>> 13543 array temp(2:6) _C2_ - _C6_;
>> 13544 do i=2 to 6;
>> 13545 call define (i,"style","style=[tagattr='type:Number
>> Format:#,##0']");
>> 13546 end;
>> 13547 endcomp;
>> 13548
>> 13549
>> 13550 compute Grain_Code;
>> 13551 if _break_ = '_RBREAK_' then
>> 13552 Grain_code="ZZ";
>> 13553 endcomp ;
>> 13554
>> 13555 RBreak after / SUMMARIZE;
>> 13556 run;
>> 13556! title1; title2;
>> ERROR: Missing numeric suffix on a numbered variable list (_C2_-_C6_).
>> ERROR: Too few variables defined for the dimension(s) specified for
> the array temp.
>> NOTE: The preceding messages refer to the COMPUTE block for dummy.
>> NOTE: Will not run due to compilation errors.
>> ERROR: Missing numeric suffix on a numbered variable list (_C2_-_C6_).
>> ERROR: Too few variables defined for the dimension(s) specified for
> the array temp.
>> NOTE: The preceding messages refer to the COMPUTE block for dummy.
>> NOTE: Will not run due to compilation errors.
>> NOTE: The SAS System stopped processing this step because of errors.
>> NOTE: There were 60 observations read from the data set OK.TABLE_1.
>> NOTE: PROCEDURE REPORT used (Total process time):
>> real time 0.04 seconds
>> cpu time 0.04 secon
>>
>>
>>> Date: Thu, 7 Apr 2011 14:16:37 -0500
>>> From: zhangyu05@GMAIL.COM
>>> Subject: Re: Proc Report, Across, style(column) tagattr
>>> To: SAS-L@LISTSERV.UGA.EDU
>>>
>>> When you have a Across variables, the other variables associated with
>
>>> that across var will be given a different name in form of _Cxx_, xx
>>> is a number, depends on how many vars were define before that
> variables.
>>>
>>> you need to write the column's name out and apply the style statement
>
>>> for each of them. you can write a loop statement to do that.
>>>
>>> you can add a dummy variable called dummy in your column statement:
>>> Columns grain_code (crop_yr, tonnes) dummy;
>>>
>>> then
>>>
>>> compute dummy;
>>> array temp(2:7) _C2_ - _C7_;
>>> do i=2 to 7;
>>> call define (i,"style","style=[tagattr='type:Number Format:#,##0']");
>
>>> end; endcomp;
>>>
>>>
>>> Hope it helps.
>>>
>>> Yu
>>>
>>>
>>> 2011/4/7 Sudo Ku <crafty876@hotmail.com>
>>>
>>> > Hi:
>>> >
>>> > Hope everyone is having (had) fun at Global Forum. I had to let
>>> > some else go this year and in lieu of attendance I have been
>>> > challenged with converting some excel reports from Proc tabulate to
>
>>> > proc report. On the First and simpliest of the reports I have run
>>> > into a formatting problem that I am pretty sure is related to my
> across statement.
>>> >
>>> > The problem I am having is that the
>>> > style(Column)={tagattr='type:Number
>>> > Format:#,##0'}; in the define tonnes statement isn't having the
>>> > desited effect of giving me the excel format that was requested.
>>> >
>>> >
>>> > My code looks like this:
>>> >
>>> > /******* Create the English Excel File ****/ ods TAGSETS.EXCELXP
>>> > file="M:\Programs\Annual Exports Pub\Report.ANNUAL EXPORTS
>>> > 2009-2010 English.&sysdate .xls" STYLE=Anh; *ods TAGSETS.EXCELXP
>>> > file="I:\Export Publication Annual\2009-2010 Annual Exports\ANNUAL
>>> > EXPORTS 2009-2010 English.&sysdate .xls" STYLE=Anh; ODS
>>> > Tagsets.excelxp options(Sheet_interval="None" sheet_name="Table 1"
>>> > orientation="Landscape" center_horizontal='YES'
>>> > absolute_column_Width="15,15,10,10,10,10,10" autofit_height="YES"
>>> > zoom="100" fittopage="Yes" Embedded_titles="yes"
>>> > embedded_footnotes="yes"); $B!! (B proc report data=OK.table_1
>>> > nowindows ;
>>> >
>>> > title1 ' '; title2 "Table 1. Total grain and wheat flour exports
>>> > (metric tonnes)";
>>> >
>>> > Columns grain_code crop_yr, tonnes; define grain_code / group " "
>>> > format=$tab1_grain_e. order=data; define crop_yr / across " "
>>> > Format=crop_yr. order=data; define tonnes / analysis Sum
>>> > format=comma13. " "
>>> > style(Column)={tagattr='type:Number Format:#,##0'};
>>> >
>>> >
>>> > compute Grain_Code;
>>> > if _break_ = '_RBREAK_' then
>>> > Grain_code="ZZ";
>>> > endcomp ;
>>> > RBreak after / SUMMARIZE;
>>> > run; title1; title2;
>>> > ODS tagsets.excelxp close;
>>> >
>>> > Thanks for the help,
>>> >
>>> > Kevin
>>> >
>>
> ************* IMPORTANT - PLEASE READ ********************
>
> This e-mail, including attachments, may include confidential and/or proprietary information,
> and may be used only by the person or entity to which it is addressed. If the reader of this
> e-mail is not the intended recipient or his or her authorized agent, the reader is hereby
> notified that any dissemination, distribution or copying of this e-mail is prohibited. If you
> have received this e-mail in error, please notify the sender by replying to this message
> and delete this e-mail immediately.
>
>
|