Usage Note 22860: Can I format the histogram midpoint values in PROC UNIVARIATE or PROC CAPABILITY?
Beginning in SAS 8 for PROC CAPABILITY and SAS 9.1 for PROC UNIVARIATE, you can add a FORMAT statement to format the midpoint values of the analysis variable.
In earlier releases, formatted values are not used by these procedures and FORMAT statements are ignored. The FMTMIDPT program below provides a method of formatting the default midpoint values which are generated by the HISTOGRAM statement.
/************************************************************************
FMTMIDPT
DISCLAIMER:
THIS INFORMATION IS PROVIDED BY SAS INSTITUTE INC. AS A SERVICE TO
ITS USERS. IT IS PROVIDED "AS IS". THERE ARE NO WARRANTIES,
EXPRESSED OR IMPLIED, AS TO MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE REGARDING THE ACCURACY OF THE MATERIALS OR CODE
CONTAINED HEREIN.
PURPOSE:
NOTE: This program is not needed if you are using Version 7 or later
of the SAS System. Beginning in Version 7, formats and FORMAT
statements are honored by PROC CAPABILITY.
Prior to Version 7, PROC CAPABILITY does not use formatted values of the
analysis variable and FORMAT statements are ignored. This program
provides a method of formatting through the use of the VALUE= option on
an AXIS statement.
REQUIRES:
Base SAS
SAS/QC
SAS/GRAPH
USAGE:
Change the %LET statement to the numeric format you want to
use for histogram midpoint values.
************************************************************************/
%let fmt=time8.; /* assign the appropriate numeric format to &FMT */
/* generating a test data set */
data test;
informat downtime time8.;
format downtime time8.;
input downtime @@;
datalines;
1:15:26 2:03:59 18:20:13 32:08:08 21:42:30
11:54:55 4:05:35 11:58:25 17:03:03 1:09:52
5:07:35 1:34:06 5:22:13 11:09:32 20:47:51
3:11:11 3:02:40 30:20:35 6:02:38 12:46:52
11:57:20 16:01:47 0:59:06 7:23:42 3:54:25
5:48:22 2:59:20 15:09:34 31:42:21 6:42:56
21:37:35 2:02:47 20:14:07 19:52:40 15:28:55
2:23:35 2:27:39 22:53:29 11:55:01 0:44:27
6:55:00 9:06:29 0:45:40 3:13:20 6:22:10
16:46:32 0:35:26 33:52:42 0:24:20 2:32:18
;
run;
/* run PROC CAPABILITY to create an OUTHISTOGRAM= data set */
proc capability data=test graphics noprint;
histogram downtime / outhistogram=outhist ; *nochart;
run;
/* create macro variable &MIDPTLST for the MIDPOINTS= list
of actual values and macro variable &VALLST for the
VALUE= list of formatted values */
%let midptlst=;
%let vallst=;
data _null_;
set outhist;
call symput('midpt',trim(left(_midpt_)));
call execute('%let midptlst=&midptlst &midpt;');
call symput('fmtmidpt',"'"||trim(left(put(_midpt_,&fmt)))||"'");
call execute('%let vallst=&vallst &fmtmidpt;');
run;
/* create the HISTROGRAM with formatted values of the midpoints */
axis1 value=(&vallst);
proc capability data=test graphics noprint;
histogram downtime / haxis=axis1
midpoints=&midptlst;
run;
title;
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Usage Note |
| Priority: | low |
| Topic: | SAS Reference ==> Procedures ==> CAPABILITY
|
| Date Modified: | 2005-07-08 10:30:07 |
| Date Created: | 2002-12-16 10:56:45 |