NCSS

Macros

NCSS has an interactive (point and click) user interface which makes in easy to learn and use. At times, however, it is necessary to repeat the same steps over and over. When this occurs, a batch system becomes more desirable. NCSS 2007 includes a macro system that utilizes a batch language with over 45 commands that lets you create a macro (script or program) and then run the macro. With the click of a single button, you can have the program run a series of procedures. You may record a macro by saving the steps as you complete an analysis or write your own script. This tool allows you to call and run an NCSS routine from within another environment.

[Back to NCSS] [Back to NCSS Procedure List] [Back to NCSS Upgrade Page]


Below are some example macros:

Example 1 - Automatically Run a Procedure

This macro opens a dataset and calculates descriptive statistics on the first five variables of that dataset.

'***  Open a dataset
DataOpen "C:/Program Files/NCSS97/Data/Sample.s0"

'***  Load the Descriptive Statistics procedure
'***  Note that the default values are used.

LoadProc DescStat

 '***  Specify that the first five variables are to be analyzed
Option DescStat  1 "1:5"

'***  Run the analysis
RunProc DescStat
 

Example 2 - Run Several Procedures

This macro opens a dataset, calculates descriptive statistics on the first two variables, and then runs a linear regression using those two variables.

DataOpen "C:/Program Files/NCSS97/Data/Sample.s0"
LoadProc DescStat
Option DescStat  1 "1:2"
RunProc DescStat
LoadProc LinReg
Option LinReg 204 1
Option LinReg 205 2
RunProc LinReg
 

Example 3 - Simple Looping

This macro opens a dataset and calculates descriptive statistics on the first five variables of that dataset. Unlike Example1, this macro uses a simple loop to step through the five variables.

Notice that the loop finishes once the variable I# is equal to '5'.

DataOpen "C:/Program Files/NCSS97/Data/Sample.s0"
I#=0
Flag1:
        I#=I#+1
        LoadProc DescStat
        Option DescStat 1 I#
        RunProc DescStat
IF I#<5 GOTO Flag1
 

Example 4 - Multiple Analyses Using Filters

This macro opens a dataset and runs separate simple linear regression analyses and scatter plots for three groups within the dataset. The three groups are defined be the ‘Iris’ variable in the dataset. The macro finds the levels of the ‘Iris’ variable and uses the resulting values to determine the groups. Thus, the macro does not require knowledge of the group names nor does it require knowledge of the number of groups to be analyzed.

'Open the FISHER.S0 database. %p% is replaced by the folder that

'was used for installation.
DataOpen "%p%\Data\FISHER.S0"

'Obtain the unique values of the Iris variable and put them in C21
VarTrans C21 "Uniques(Iris)"

RunTrans

'Obtain the number of unique Iris values using C21
NumRows C21 n1#

'Loop through the unique Iris values for grouping
I1# = 1
Flag1:
GetCell C21 I1# IrisGroup$

'Filter the values according to the Iris variable
LoadProc Filter
LoadTemplate Filter "Example5_Macro"
IrisFilter$ = "Iris = " & IrisGroup$
Option Filter 3 IrisFilter$
RunProc Filter
UnLoadProc Filter

'Run the Linear Regression procedure for the filtered group
LoadProc LinReg
LoadTemplate LinReg "Example5_Macro"
RunProc LinReg
UnLoadProc LinReg

'Run the Scatter Plot procedure for the filtered group
LoadProc ScatPlot
LoadTemplate ScatPlot "Example5_Macro"
RunProc ScatPlot
UnLoadProc ScatPlot

'Loop through the unique Iris values for grouping
I1# = I1# + 1
IF I1# > n1# GOTO Flag2
GOTO Flag1

'Turn Filter Off
Flag2:
LoadProc Filter
Option Filter 1 0
RunProc Filter
UnLoadProc Filter

'End of Macro
Print "MACRO COMPLETE"

Download a 7-day Trial Copy of NCSS 2007

Download 

Place an Order Using Our Secure Online Order Form

Buy Now 

Upgrade Now to
NCSS 2007

from NCSS 2004:
$299.95 (commercial)
$249.95 (academic/government)

from Earlier Versions:
$399.95 (commercial)
$349.95 (academic/government)

NCSS 2007 is now available. This version adds several new procedures and features to NCSS, including mixed models, macros, and an enhanced user interface. Here is a summary of the new procedures, tools, and features:

Procedures
Mixed Models
Circular Data Analysis
Data Matching - Optimal and
  Greedy

Data Simulator
Data Stratification
Double Dendrograms
Merging Two Databases
Multiple Regression with Serial
  Correlation Correction

Nondetects Analysis
Nondetects Regression

Tools
Macros (Programmability)
Color Selection Windows
Quick Launch Window

Features
Enhanced User Interface
Improved Help System

Upgrade Now

Read about what’s new in NCSS 2007.

View the upgrade brochure.
View the NCSS 2007 brochure.


Download an NCSS Update

Most Recent NCSS 2007 Update
Released February 19, 2010

Update

What problems have been fixed by recent NCSS updates?


Sample NCSS Reports

Click here for the complete list.

Analysis of Variance
Appraisal Methods
Binary Diagnostic Tests
Charts and Graphs
Cross Tabulation
Curve Fitting
Descriptive Statistics
Design of Experiments
Forecasting
General Linear Models
Meta-Analysis
Multivariate I
Multivariate II
Proportions
Quality Control
Regression Analysis
Reliability Analysis
Repeated Measures
ROC Curves
Survival Analysis
Time Series Analysis
T-Tests

System Requirements
PASS 2008, NCSS 2007, and GESS 2006 run on 32-bit and 64-bit systems with Windows 7, Vista, XP, 2000, NT, ME, 98, or 95. Requires pentium-class computer with at least 32 MB of RAM. Requires 200 MB of hard disk space. Requires Adobe Reader® version 7 or later to use the NCSS, PASS, and GESS Help Systems.

Accuracy
We at NCSS have put a great deal of effort into finding the most accurate algorithms possible. The programs have been tested and verified over and over, both by us and by our customers. Each routine has been verified against textbooks, journal articles, and, where possible, other software. NCSS is one of the most accurate statistical analysis programs available. NCSS calculates with seventeen-digit, double-precision accuracy.

Guarantee
If you are not completely satisfied with an NCSS product during the first 30 days for any reason, return the program for a full, prompt refund (excluding shipping).

Home | Order | Downloads | Support | News | Contact Us | Site Map

NCSS • 329 North 1000 East • Kaysville, Utah 84037 • USA
Email: sales@ncss.com   Phone: (801) 546-0445   Toll Free: 1-800-898-6109   Fax: (801) 546-3907