The STORE statement enables you to assign the contents of previously saved tables to macro variables. You can reuse the results from one statement as input for subsequent statements in the same IMSTAT procedure.
specifies the column number to access as it appears in the default output or with the REPLAY statement. Be aware that hidden columns that might appear in an output data set when an ODS table is converted to a SAS data set are not counted. The first column is numbered 1. You can specify _ALL_ as an alternative, or specify the column names in the COLS= option.
specifies the name of a macro variable to use for storing the value.
specifies the saved result table to use.
specifies the row number to access as it appears in the default output or with the REPLAY statement. The first row is numbered 1. You can specify _ALL_, _LAST_, a numeric list of rows (row-list), or a WHERE clause as alternatives. When you specify a row-list, any row number less than 1, greater than the number of rows, and duplicate row numbers, are ignored.
Examples | The following row-list accesses rows 0, 1, and 2 from
the results.(0, 1, 2) |
The following row-list accesses rows 0, 1, 2, 4, 8,
12, 16, and 20.(0 to 2 by 1, 4, 8 to 20 by 4) |
specifies the table
to use for accessing multi-part tables. In the following example,
the HISTOGRAM statement generates one histogram table for the Cylinders
variable and a second for the EngineSize variable. The two histogram
tables are stored in the temporary HistTab table. In order to access
the second histogram table, the [2]
is
used. If you do not specify a table-number, the first table is used.
Example | proc imstat data=mylasr.cars(tag=sashelp);;
histogram Cylinders EngineSize / save=HistTab;
store HistTab[2](2,6) = Engsz_Pct;
quit;
%put &Engsz_Pct; |
specifies the string
that used to format cell values before they are stored in the macro
variable. The control string must include the same number of placeholders
as the number of columns. The default placeholder is %
.
There are two more placeholders besides %
, #
and ^
.
If the i-th placeholder in CONTROL= is:
specifies the string to assign as a prefix to the macro variable.
specifies to ignore duplicate formatted cell values.
Restriction | This option applies to numeric values only and when only one column is accessed from the results. |
specifies the string to assign as a suffix to macro variable.
specifies the string to use for separating the formatted cell values.
Default | " " (the space character) |
summary mpg_city
/ save=mpgtab;
. The ODS output
is shown in Example 3.store mpgtab(1,6) = meanMpgCity;
because
the Mean column is the
sixth column. However, it is more robust to reference columns by name,
such as store mpgtab(where="Column eq 'MPG_City'",
cols=Mean) = meanMpgCity;
.
proc template;
source LASR.IMSTAT.Summary; 1
run;
1 | The LASR.IMSTAT portion of the source statement is common to all statements in the IMSTAT procedure. The name of the table, such as Summary, is provided in the documentation for each statement. |
define table Lasr.Imstat.Summary; notes "Descriptive Statistics"; dynamic TableName; column Table GroupBy Column Min Max N Sum Mean Std StdErr CV CSS USS TValue ProbT NMiss Bin; header h1; define h1; text "Summary Statistics for Table " TableName; space = 1; spill_margin; ...
proc imstat data=example.cars(tag=sashelp);
histogram Cylinders EngineSize / save=HistTab;
store HistTab[2](2,cols= percent) = Bin2Pct;
quit;
%put &Bin2Pct;
NOTE: The string 19.626168224 related to table histtab has been stored in the macro variable bin2pct. %put &bin2pct; 19.626168224
proc imstat data=example.cars(tag=sashelp); distinct _numeric_ / save=distincttab; run;
store distincttab (where="NDistinct > 100", 1) = varlist1; run;
NOTE: The string MSRP Invoice Horsepower Weight related to table distincttab has been stored in the macro variable varlist1.
store mpgtab (_last_, cols=Mean) = avgmpgcity; run; summary mpg_city / groupby=make save=summarytab; run;
store summarytab (where="Mean > &avgmpgcity",cols=Make) = highmpgmakes / left="Make in (" control="'%'" separator=", " right=")"; run;
NOTE: The string Make in ('Honda', 'Hyundai', 'Kia', 'MINI', 'Mazda', 'Mitsubishi', 'Oldsmobile', 'Pontiac', 'Saab', 'Saturn', 'Scion', 'Subaru', 'Suzuki', 'Toyota', 'Volkswagen') related to table summarytab has been stored in the macro variable highmpgmakes.
proc imstat data=example.cars(tag=sashelp); percentile mpg_city / save=mpgtab; run;
store mpgtab (where="Pctl >= 50", cols=Value Value) = q3 / control="(mpg_city between # and ^)"; run;
NOTE: The string (mpg_city between 19 and 21.5) related to table mpgtab has been stored in the macro variable q3.