
* NOTE: The Sashelp.Stock data set is already sorted by Stock and by Date.īe sure to sort your data if you want to use the BY statement. * prepare data to display information */ if Stock= 'IBM' then Trend= 'Neutral ' Įlse if Stock= 'Intel' then Trend= 'Increasing' Įlse if Stock= 'Microsoft' then Trend= 'Decreasing' The TREND variable indicates whether the stock price increased or decreased during the time period. The DATA step restricts the data to the time period Jan 1998 – May 2000. The OPEN variable contains the opening stock price for these companies for each month. The STOCK variable contains the name of three stocks: IBM, Intel, and Microsoft.

The following DATA step creates a subset of the Sashelp.Stocks data. In real life, you would use a separate analysis to determine whether each stock increased or decreased, but I will hard-code this information for the three stocks in the example data. I will use the same data as for the previous article.
BLOCK VARIABLE SEQUENTIAL TESTING SAS HOW TO
This article shows how to use the #BYVAR and #BYVAL keywords in SAS titles to display information about the data in each subgroup.

The previous article discusses several advantages and disadvantages of using the SGPANEL procedure for this task.Īn alternative approach is to use the BY statement in the SGPLOT procedure to process each subgroup separately. In the example, the data are time series for the price of several stocks, and the headers include information about whether the stock price increased, decreased, or stayed the same during a time period. It focuses on using headers to display information about each graph. A previous article describes how to use the SGPANEL procedure to visualize subgroups of data.
