Charting query results as a histogram
You can chart your query results as a histogram by using QMF Analytics for TSO.
About this task
Histograms are commonly used for showing frequency distributions and for presenting data categorically in the form of a vertical bar chart.
The type of histogram (bar versus frequency) that QMF Analytics for TSO generates depends on the type of data in the independent variable (horizontal x-axis) and other factors related to the data.
In this example you will query product sales data and chart how many units your sales representatives are selling.
Procedure
- Start QMF for TSO.
Your QMF administrator can tell you how to start a QMF session and give you a user ID. Check with your QMF administrator if you have any questions about getting started with QMF.
- From the QMF Home Panel, enter DISPLAY
Q.SALES on the command line and press Enter.
QMF for TSO displays the query result as a multi-columned report.
Figure 1. Query Results REPORT Q.SALES LINE 1 POS 1 79 ORDERNO SALESREPNO PRODNO QUANTITY CUSTNO ------- ---------- ------ -------- ------ 3456 20 10 50 1200 6667 20 160 120 4400 1991 40 150 600 4500 7777 60 30 150 8500 1020 60 30 150 8500 3333 70 50 240 9600 1115 70 101 120 8300 3580 20 190 360 4900 2345 90 450 360 2500 5770 70 205 100 8300 6432 40 150 120 8900 4432 90 505 150 2550 3455 150 190 360 8800 4477 220 330 480 5600 6540 150 150 200 8850 6688 280 150 300 6600 4080 300 101 500 5900 5456 300 20 60 6300 3360 310 101 120 3600 4596 310 160 100 2000 4321 340 330 200 3000 4567 40 450 100 4100 7010 20 505 150 3500 1550 90 160 200 4000 2888 90 50 240 5000 5432 220 20 100 6000 6677 40 10 150 9111 5521 60 50 150 9666 4010 150 205 225 4297 3968 220 509 200 7329 5832 280 509 300 7299 4491 300 50 100 5581 3962 340 10 240 3681 1=Help 2= 3=End 4=Print 5=Chart 6=Query 7=Backward 8=Forward 9=Form 10=Left 11=Right 12= OK, Q.SALES is displayed. COMMAND ===> SCROLL ===> PAG
- Enter SHOW ANALYTICS on the command line and press Enter to start QMF Analytics for TSO.
- Tab to Histogram in the Charts section
of the QMF Analytics for TSO Home
panel and press Enter.
The Parameter Selection panel is displayed.
- Create the specification for your analysis.
Set your parameters as shown in the following table.
You can enter column names manually or you can tab to the field and press the List function key (F4).
The List function opens a Column Selection window that lists all of the column names from the query result. To select a column from the Column Selection window, tab to the column name and press Enter. QMF Analytics for TSO adds the name to the Parameter Selection panel automatically.
Table 1. Parameter Settings for your Histogram Parameter Setting Specify the column to form the vertical coordinates (y-axis) QUANTITY Specify the column to form the horizontal coordinates (x-axis) SALESREPNO Specify the column to control grouping of your data Leave this field blank Tabulation? No Chart Title Enter a title for your chart in the Chart Title field or accept the default value of asterisk (*).
If you accept the default value of asterisk (*), QMF Analytics for TSO creates a title based on the columns that you have selected.
If you delete the asterisk (*) and leave this field blank, the analysis output will not include a title.
The following illustration shows the histogram parameters and the corresponding columns from the query result.Figure 2. Query Results and Parameter Selection - Optional: Press the Save function key (F5)
to save the specification to the QMF database
as an ANALYTIC object. Saving the specification to the database allows you to run your analysis directly from the QMF command line at a later time, without having to navigate to the QMF Analytics for TSO Home panel and reenter the parameters. Saving specifications makes sense if you plan on running the analysis frequently or multiple times.Note: The global variable DSQEC_SESSGLV_SAV in QMF controls how the autosave for parameter settings works. For information about Global Variables, see Global Variable List in the QMF help.
- Press the Run function key (F2).
QMF Analytics for TSO generates the histogram based on the parameters you selected.
Figure 3. Histogram of query results The quantity of units sold is plotted on the vertical axis (the Y axis). The sales representative ID number is plotted on the horizontal axis (the x axis). The char illustrates that sales representative 40 has sold the most units, while sales representative 310 has sold the least.
- Optional: If you have configured print capabilities in QMF, you can print the chart.
- Press the End function key (F3) to return to the Parameter Selection panel.
- Tab to the Tabulation? field and
change the setting from
No
toYes
. - Press the Run function key (F2) to generate the histogram
with tabulation.
Figure 4. Histogram of query results with tabulation QMF Analytics for TSO generates the histogram and includes the tabulated results under the horizontal axis.
- Press the End function key (F3) to return to the Parameter Selection panel.
- To demonstrate the Grouping function: and select MONTH.
- Tab to the Specify the column to control grouping of your data field select the List function key (F4) .
- Tab to PRODNO and press Enter.
By adding a column to the Specify the column to control grouping of your data you are telling QMF Analytics for TSO to add an additional level of grouping to the analysis.
- Tab to Tabulation? and select
No
.Your Parameter Selection panel should look like this:Figure 5. Parameter Selection showing Grouping Column ANALYTICS -- HISTOGRAM Parameter Selection Specify the column to form the vertical coordinates (y-axis) ( QUANTITY ) Specify the column to form the horizontal coordinates (x-axis) ( SALESREPNO ) Specify the column to control grouping of your data ( PRODNO ) Tabulation? Yes / No Chart Title ===> * 1=Help 2=Run 3=End 4=List 5=Save 6= 7= 8= 9= 10= 11= 12=
- Press the Run function key (F2).
Figure 6. Histogram of query results charting rainfall by year and by month Quantity is still plotted on the vertical axis. But data along the horizontal axis now includes an additional layer of information. The horizontal axis “groups” the sales representative ID with the product identifiers (PRODNO) .
- Optional: If you have configured print capabilities in QMF, you can print the chart.
- Press the End function key (F3) to return to the Parameter Selection panel.
- Press the End function key (F3) to return to the QMF Analytics for TSO Home panel.