FULL-SCREEN MENU-DRIVEN SAMPLE SIZE PROGRAMS USING SAS/AF® SOFTWARE! L. A. Johnson, IBM Systems Technology Division P. J. Cirulli, IBM Systems Technology Division J. A. Bebar, IBM Systems Technology Division ABSTRACT This paper describes the efforts and results of writing a ful1®screen menu®driven application using base SAS and SAS/AF software. The application involves making the calculation of sample sizes required in various situations such as estimation and hypothesis testing for both variables and attributes as easy as possible. The goals were minimizing the number of screens a user had to go through before obtaining the result, individual help screen for each prompt with an example and reference and, finally. to have the result appear on the same screen as the prompts. These goals were all accomplished using commands and options available in SAS/AF software. Examples of the programs and various screens and problems encountered using SAS/AF software are included. 3. The system must contain plenty of on-line help. In addition to the example situation, additional explanation of all inputs required is given. References are also listed in case further explanation is required. 4. The programs must display the result on the same screen as the input. This would avoid confusion as to what input parameters produced the result. 5. A user of the program must view as few screens as possible. For any application, only two screens need to be viewed by the user. III. SAS/AF PROCEDURES SYSTEM DEVELOPMENT Developing the system involved five steps: 1. INTRODUCTION Sample size calculations are frequently required by engineers for applications such as process or product qua.lification and experiment design. To address this need, full-screen menu-driven sample size calculation programs were written. The programs were written using base SAS and SAS/AF software. II. SYSTEM REQUIREMENTS The system was written so that engineers could perform initial sample size calculations with a minimum of assistance from a statistician. In order for the system to fulfill this goal, the following were felt to be requirements of the system: 1. The system must be menu-driven with few screens. Menu-driven programs make the system easy to use. 2. The system must have examples of situations where each calculation would be used. In this way, the engineer can determine if the option chosen is appropriate for their situation. 1. Writing and testing the sample size calculation programs independent of SAS/AF software 2. Creating the SAS/AF menu and program screens 3. Adjusting and testing the progreqs to interface with the screens 4. Creating the help screens 5. Putting the programs on common system disks Step 1 The sample size calculation system was divided into two categories, estimation and hypothesis testing. Each of these groups was then further divided into attribute data and variables data for a total of thirteen different types of calculations. Each type of sample size calculation represented a separate program. The thirteen programs were first written in base SAS software without using SAS/AF software. Values for the variables that the user would later input via the SAS/AF screens were contained 1281 within the programs. The program results would be written to the SAS LOG. Each of the programs was run several times modifying the variable values and verifying the results in order to test the sample size algorithms. The ATTR command was entered from the command line of MAIN.MENU next. This produced another screen that allowed the programmer to specify the program name that is to be executed depending on the selection the user makes, and which PF Key and/or typed number would cause the associated program to be executed. Step 2 The program screens were then designed, each one having the same format and colors. The next step was to create the program selection menu. The command: A macro variable was used wherever the user is to enter data-or program results displayed. Any underscores that immediately follow a variable name serve as place holders. For example, the name &MSGS5 only takes up 6 bytes, but the field it represents requires 7 bytes. The underscore stands for the seventh byte. PROC BUILD CATALOG-STAT .PGM; RUN; was submitted from the,SAS display manager. The BUILD procedure put the programmer into the SAS/AF catalog where the actual menus and program screens were developed. The program screen for the estimation of a normal standard deviation is shown below. It was created in a manner similar to the main menu. The command, EDIT VARO.PROGRAM, was entered from the command line of the directory, and the contents of the screen were then typed in the blank screen area following the format described above. To create the main menu, EDIT MAIN.MENU was typed on the command line. The command DES Sample Size Calculations was first entered onto the command line to change the title of the screen. The default title that originally showed up was MAIN.MENU, the menu name. The rest of the menu screen was simply typed in the blank area exactly as it was to appear to the user using the appropriate color keys. The completed menu is shown below. Sample Size Calculation Command ==-> Text Editor Col 001 079 Estimation of a Normal Standard Deviation Problem Statement: The result will be the sample size necessary to estimate S between sigma/f and sigma*f, with about 100 (GAMMA) % probability. Sample Size Calculations Command ===> ESTIMATION Attribute Data Please Input: HYPOTHESIS TESTING Attribute Data f: &fs5 GAMMA: &gammas5 1. Binomial Proportions 8. Binomial Proportion, one sample 2. Nonparametric Tolerance Intvls 9. Binomial Proportion, two sample Note: The accuracy of this approximation increases with the sample sizes; it is reasonable for n > 15. Variables Data &m8g85_ &lmsgs5____________________ &ns5 Variables Data 3. Normal Mean, one sample 10. Normal Mean, one sample 4. Difference Between Two Normal Means 11. Normal Mean, two samples 5. Normal Standard 12. Normal Variance Deviation f Text Editor (Hit PFI for HELP, PF2 to SUBMIT, PF3 to EXIT.) Next the ATTR command was executed from the program screen in order to specify more information about each of the program variables. The standard deviation program screen as the user would see it is shown below. Underscores automatically show up in place of the macro variables &FS5 and &GAMMAS5 which signifies to the user to enter data in these fields. The other macro variables &MSGS5, &LMSGS5, and &NS5 do not show up at all, even as underlines, until the program is submitted. 6. Normal Variance (Based on C.I. Midpoint) 7. Ratio of Two Normal Variances 13. Ratio of Two Normal Variances (Hit PFI for HELP, PF3 to EXIT) 1282 Command ... --> Sample Size Calculation Step 4 Estimation of a Normal Standard Deviation The fourth step was to create the help screens. Each help screen contained an example, and theformats and colors were similar. If the PF1 key was hit from anywhere on the program screen, the user would be shown an overall help screen. If the cursor was positioned in one of the input fields, a help specific to that variable would be displayed. Problem Statement: The result will be the sample size necessary to estimate S between sigma/f and sigma'f, with about 100 (GAMMA) % probability. Please Input: The overall help screen is shown below. The help screens were created by issuing the EDIT command. and then typing on the blank screen. The overall help screen must have the same name a8 the program. For example, the help screen for VARO.PROGRAM was called VARO.HELP. The help screens for each of the variables could have been named anything as long as the second qualifier was HELP and the name appeared on the program screen attributes for the correct variable. f: GAMMA: Note: The accuracy of this approximation increases with the sample sizes; it is reasonable for n > 15. (Hit PF1 for HELP, PF2 to SUBMIT, PF3 to EXIT.) Est. of a Normal Standard Deviation Command -==> Press FORWARD for more. PF2 to Exit Help Screen_ Step 3 Estimation of a Normal Standard Dev1ation~ sigma, between sisma/f and sigma*f, with 100 (GAMMA) % probability. The next step involved copying the independent programs and appending them onto their associated SAS/AF program screens. The programmer exited from the catalog returning to the SAS display ~nager. In order to copy in the Normal Standard Deviation Program, VARO SAS, the following commands were executed: Overall Help Screen Example: We wish to estimate sigma (the standard deviation of a normal distribution) within a factor f-1.20 with 90% probability. In this example, f - 1.20 and galDma - 0.90. CMS FILEDEF VARO DISK VARO SAS A; PROC BUILD CATALOG-STAT.PIlMS; RUN; The programmer was then put back into SAS/AF catalog, and the following commands were entered one at a t:l.m.e: Prompts: 1) f: 2) GAMMA: EDIT VARO.PROGRAM Common Values any value greater than 0.90, 0.95, 0.99 FILL - Reference: Nelson, W. (1982). tfApplied Life Data Analysis." John Wiley and Sons, New York. INCLUDE VARO Step 5 The EDIT command brought up the VARO program screen that had been previously created. One should note that the FILL command was issued from the command line, but the cursor was moved down to the end of the screen before the enter key was hit. This caused a dashed line to be put at the end of the program screen which separates the screen from the program itself. The INCLUDE command then appended the VARO SAS program onto the end. The final step was putting the programs' on cammon system disks so the engineering community would have access to the sample size system. A small program, STATPGM EXEC, was written in Restructured Extended Executor (REXX) language and also put out on the system disks. This makes it possible for an engineer to use the system without knowing any SAS statements. From Conversational MOnitor System (OMS). one needs only to type the command, STATPGM. Within the EXEC is: Each of the programs written using base SAS software was copied one by one in the same fashion. 1283 IV. DEMONSTRATION PROC DISPLAY CATALOG=STAT. PGMS .MAIN.MENU; RUN; Example: The exec also creates a log of all userlds using the programs. This has been helpful to the authors in measuring the system's usage. Sample Size for Estimation of Mean The following pages contain an example of accessing and running the sample size programs. The pr,ograms can be run by typing In addition, the system does not use the default PF keys that were installed at the site. Therefore, the REXX program copies a 5PROFILE SASUSER onto the user's disk. As soon as the user exits from the sample size calculation system, this profile is automatically erased. One should note that before anything 1s copied though, the program does check to see if the engineer already has his own 5PROFILE SASUSER. STATPGM while in CMS. STATPGM is a REXX exec which temporarily defines PF keys and displays the Main Menu. In the example, option 10 is chosen. This option is for calculating sample sizes for hypothesis testing for a normal mean, one sample. The input and help screens for this example are shown. If this is the case, the user 1s then informed that his version will be renamed temporarily, or he 1s given the chance to exit from the system. Main Menu, Option 10 Chosen HINTS/PROBLEMS Sample Size Calculations Color Select Option To use color in the screens was actually very simple although this is not explained anywhere in the SAS/AF manuals. If one is using an IBM 3279 model 3X, for example, the colors can be changed by using the ALT key along with the PF keys. -----> 10 Press END to return ESTIMATION HYPOTHESIS TESTING Attribute Data Attribute Data 1. Binomial Proportions 8. Binomial Proportion, one sample 2. Nonparametric Tolerance Intvls PF Keys An inconsistency was found in the PF keys. Variables Data According to the SAS/AF documentation the END and CANCEL commands should work from both help screens and program screens. From a program screen CANCEL will exit the screen immediately, while END will submit the program. Since most of the engineers at this site are used to using PF3 as an exit key, the PF3 key was set up to be CANCEL, and PF2 represented END. 9. Binomial Proportion, two sample Variables Data 3. Normal Mean, one sample 10. Normal Mean, one sample 4. Difference Between Two Normal Means 11. Normal Mean, two samples 5. Normal Standard Deviation 12. Normal Variance 6. Normal Variance (Based on C. I. The help screens did not work like this though. Entering the CANCEL command only produced an error message. The only way to exit help was to enter END. Therefore, the engineers must use PF3 to exit from a program screen but PF2 to exit from, a help screen. Midpoint) 7. Ra tio of Two Normal Variances 13. Ratio of Two Normal Variances (Hit PF1 for HELP, PF3 to EXIT) Error Messages Option 10 Input Screen It is very easy to set up audits from the Program Attribute Screen. When users input invalid data, a message appears on the screen automatically notifying them of an error. This message is not very descriptive, however. It will simply read "Invalid Entry at Row-XXX Column-XXX. Please reenter." In this particular system the valid entries are contained within the help screens so it did not present a signif:", ' icant problem .. Sample Size Calculations Command ---> Tests of Hypothesis About a Normal Mean Problem Statement,: The result will be the sample size necessary to test the hypothesis: 1284 Please Input: HO: u - uO where: Standard Deviation: DELTA - ABS(u - uO) 4.23 Delta: Please Input: Standard Deviation: Alpha: 0.05 Delta: Beta: 0.10 Alpha: 1-1 tailed, 2-2 tailed: (Hit PFI for HELP, PF2 to SUBMIT, PrJ to EXIT.) Beta: 1-1 tailed, 2-2 tailed: Option 10 Input Screen With Final Sample Size Result (Hi t PFI for HELP, PF2 to SUBMIT, PF3 to EXIT.) Sample Size Calculations Help Screen for One- Versus Two- Tailed Test Command --=> Tests of Hypothesis About a Normal Mean Tests of Hypothesis About a Normal Mean Command _••> Press ~ to return. Problem Statement-: The result will be the sample size necessary to test the hypothesis: PF2 to Exit Help Screen One- Versus Two- Tails Help Screen HO: u - uO Example: We are producing parts that in the past had a mean thickness of 30 angstroms and a standard deviation of 3.7. After introducing a change in the process, we wish to determine if there has been a decrease in mean thickness. In par'ticular, if the thickness was as low as 28 angstroms, we want to declare this difference as significant. We will choose alpha - 0.05 and beta 0.10. Please refer to the individual help screen for alpha and beta for interpretation of these values. In this example, standard deviation· 3.7, delta·· 2. and the test is one-tailed. where: Please Input: Standard Deviation: 4.23 Delta: Alpha: 0.05 Beta: 0.10 I-I tailed, 2-2 tailed: RESULT: Prompts: DELTA - ABS(u - uO) THE SAMPLE SIZE REQUIRED IS: 154 Common Values (Hit PFI for HELP, PF2 to SUBMIT, PF3 to EXIT.) 1 - I-tailed. 2 = 2-tailed 1 or 2, here 1 Reference: Mace, A. E. (1964). "Sample Size Determination." Reinhold Publishing Corporation, New York. 1 ® ® SAS and sAS/AF are registered trademarks of SAS Institute Inc., Cary, NC, USA. Option 10 Input Screen, All Prompts Filled In Sample Size Calculations Command References ==-> 1. Mace, A. E. (1964), Sample Size Determination, Reinhold Publishing Corporation, New York 2. Nelson, W. (1982), Applied Life Data Analysis. John Wiley and Sons, Inc. J New York 3. SAS/AF User's Guide. Version 5 Edition (1985), sAS Institute, Inc., Cary, N.C. Tests of Hypothesis About a 'Normal Mean Problem Statement: The result will be the sample size necessary to test the hypothesis: HO: where: u - uO DELTA - ABS(u - uO) 1285
© Copyright 2024