Dear All,
May I please ask why am I getting this "NOTE: stat=PCT is invalid. The default will be used." from my proc sgrender? What is the default?
Below is the partial code from proc template. I am using SAS 9.4.
Thank you in advance.
993 proc template; 994 define statgraph unifonts; 995 begingraph; 996 *entrytitle 'Reason'; 997 entryfootnote ' ' / textattrs=(size=40 ); 998 layout overlay / xaxisopts=(display=( tickvalues) type=DISCRETE linearopts=( /*tickvaluelist=( 12 13 998 ! 14 15 16 17 18 19 )*/ tickdisplaylist=( 'Two or fewer hours' 'Full day' 999 'Half a day' '2 days' 'More than 2, up to 4 days' 'More than 4, up to 8 days' 'More than 8, up to 15 days' 999 ! 'It never stops' ) viewmin=12 viewmax=19 ) 1000 DISCRETEOPTS=(TICKVALUEROTATION=DIAGONAL TICKVALUEFITPOLICY=ROTATE SORTORDER=DATA 1000 ! TICKVALUESPLITCHARDROP=TRUE)) 1001 yaxisopts=(label="Percentage of subjects" offsetmin=0 griddisplay=on linearopts=(tickvaluesequence=(start=0 1001 ! end=100 increment=10) tickvaluepriority=true)); 1002 1003 barchart x=QUERES1C y=PCT_ / group=AGECAT1F groupdisplay=cluster name='agecat' Stat=PCT 1004 barwidth=1 barlabel=true barlabelattrs=(size=9pt ) barlabelformat=PCTBARLF. display=all . . . 1031 proc sgrender data=final template=unifonts ; run;
Hello @Miracle,
The BARCHART statement documentation says: "For bar charts with a RESPONSE= column, the default is SUM."
This applies to your code because Y= is an alias of RESPONSE=.
So, if your response variable PCT_ contains percentage values such as 12.34 (meaning 12.34%), the default statistic SUM is likely what you want anyway (and you can just omit the STAT= option), especially if your input dataset final contains at most one observation per combination of QUERES1C and AGECAT1F. In case of more than one observation per combination the individual values would be summed up (like 12.34%+11.5%=23.84%).
The specification STAT=PCT in the absence of a RESPONSE= column (i.e., without Y=PCT_ or without a variable PCT_ in the input dataset), however, would instruct SAS to compute the percentages. That is, SAS would count the observations in each QUERES1C-AGECAT1F category (and the overall total) and use the relative frequencies times 100 as the heights of the bars.
Hello @Miracle,
The BARCHART statement documentation says: "For bar charts with a RESPONSE= column, the default is SUM."
This applies to your code because Y= is an alias of RESPONSE=.
So, if your response variable PCT_ contains percentage values such as 12.34 (meaning 12.34%), the default statistic SUM is likely what you want anyway (and you can just omit the STAT= option), especially if your input dataset final contains at most one observation per combination of QUERES1C and AGECAT1F. In case of more than one observation per combination the individual values would be summed up (like 12.34%+11.5%=23.84%).
The specification STAT=PCT in the absence of a RESPONSE= column (i.e., without Y=PCT_ or without a variable PCT_ in the input dataset), however, would instruct SAS to compute the percentages. That is, SAS would count the observations in each QUERES1C-AGECAT1F category (and the overall total) and use the relative frequencies times 100 as the heights of the bars.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.