Date: Tue, 2 Jun 2009 10:33:22 -0400
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: Annotate error, killing me
Content-Type: text/plain;charset=iso-8859-1
hi ... in late May, a user posted a question ...
******************
Hi All,
I'm using the annotate facility to get proper formatting on a subpercentage on a bar chart My code is as follows:
<yadda yadda yadda>
The Log
NOTE: ERROR DETECTED IN ANNOTATE= DATASET WORK.B1. VARIABLE SHOWN HAS IMPROPER LENGTH IN ANNOTATE= DATASET SUBGROUP
Now , I've changed the length of subgroup to its proper length (41), a huge length (110), and let
SAS decide length, and I always end up with this error. I use this style of code on a very similar
graph and I get the expected output
******************
via "un peu de birdie" ... the problem is the length of the variable SUBGROUP in the annotate data set
in both V9.1 or V9.2, it cannot be more than 32 characters
if you try the SAS code posted below in V9.1 and set the length of
GENDER in the first data step to $33 (or greater), you will see in the LOG ...
WARNING: The values of gender have been truncated to 32 characters.
NOTE: ERROR DETECTED IN ANNOTATE= DATASET WORK.ANNO.
VARIABLE SHOWN HAS IMPROPER LENGTH IN ANNOTATE= DATASET SUBGROUP
note that the WARNING is caused by the length of SUBGROUP in the PROC, not the annotate data set
if you use V9.2 ...
NOTE: ERROR DETECTED IN ANNOTATE= DATASET WORK.ANNO.
NOTE: PROBLEM IN OBSERVATION 1 -
DATA SYSTEM REQUESTED, BUT VALUE IS NOT ON GRAPH 'SUBGROUP'
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
NOTE: PROBLEM IN OBSERVATION 2 -
DATA SYSTEM REQUESTED, BUT VALUE IS NOT ON GRAPH 'SUBGROUP'
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
<yadda yadda yadda>
NOTE: PROBLEM IN OBSERVATION 11 -
DATA SYSTEM REQUESTED, BUT VALUE IS NOT ON GRAPH 'SUBGROUP'
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
note, there is NO WARNING in V9.2 about the length of SUBGROUP
since as of V9.2 it CAN be more than 32 characters
it just CANNOT be more than 32 characters in the annotate data set
if you set the length of GENDER in the first data step to $32 (or less),
no errors (or warnings) in either version
re "Annotate error, killing me" ----> I hope you are not dead yet
if you want to experiment ...
data class;
length gender $32;
set sashelp.class;
* or repeat sex as often as desired;
gender = repeat(sex,32);
run;
proc freq data=class;
table age*gender / noprint out=pcts outpct;
run;
data anno;
retain xsys ysys '2' hsys '3' function 'label' color 'black'
when 'a' style '"calibri"' position 'e' size 2 cbox 'white' ;
set pcts (rename=(gender=subgroup age=midpoint));
text = cat(round(pct_row,0.1),'%');
run;
goptions reset=all ftext='calibri' htext=2 gunit=pct hpos=40;
axis1 label=(a=90 'PERCENT WITHIN GENDER BY AGE');
proc gchart data=pcts annotate=anno;
vbar age / discrete
subgroup=gender
sumvar=pct_row
raxis=axis1
;
run;
quit;
--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475