Analyzing the Sample Path |
When you click the Analyze button in the Simulation control panel (see Figure 9.3), the QSIM Application executes SAS code to extract and summarize the sample path saved in the WORK.SAMPLE data set. You can write a SAS program to extract and analyze these data. For example, suppose you want to subset the data on the time the queue is in each state. The following DATA step subsets WORK.SAMPLE with those observations that have state information on queue with ID 5:
data subset; set sample; if id=5; keep timenow number time; label number="Queue Length"; time = ( timenow - lag(timenow) ); number = lag(state); run;
The resulting data set has three variables: TIMENOW for the time that the state changes, NUMBER for the number in the queue, and TIME for the length of time in that state. The following SAS code executes the UNIVARIATE procedure to produce summary statistics and the GCHART procedure to produce a histogram as shown in Figure 9.5.
proc univariate data=subset; weight time; var number; run; proc gchart; label = "Time in Queue"; vbar number / subvar=time discrete; run;
A similar SAS program subsets the data on server utilization and produces the output in Figure 9.10 and Figure 9.9.
data subset; set sample; if id=4; keep timenow number time; label number="Utilization"; time = ( timenow - lag(timenow) ); number = lag(state); run; proc univariate data=subset; weight time; var busy; run; proc gchart; pie busy / sumvar=time discrete percent=outside; run;
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.