Written and maintained by CASRAI Editorial Board
Published
On this page
In SAS, “STD” is the standard deviation: the STD function returns the sample standard deviation of its nonmissing arguments, and STD is also a statistic keyword in procedures such as PROC MEANS. This guide is for researchers who need to compute, interpret and troubleshoot standard deviation in SAS. It is not about sexually transmitted diseases, which is a different use of the same abbreviation.
What the STD function does in SAS research code
According to the SAS 9.3 Functions and CALL Routines reference, STD(argument-1, argument-2 <,...argument-n>) belongs to the Descriptive Statistics category and “returns the standard deviation of the nonmissing arguments.” Each argument can be a constant, variable or expression. At least two nonmissing arguments are required; otherwise the function returns a missing value. Arguments can also be given as a variable list preceded by OF.
The key conceptual point is direction. The STD function works across variables within one observation (row). PROC MEANS works down the observations (column) for each variable. Mixing these up is the most common reason a reported standard deviation looks wrong.
STD, STDERR and related SAS terms
| Tool | Direction | What it returns |
|---|---|---|
STD(...) function in a DATA step |
Across the arguments in one row | Standard deviation of the nonmissing arguments; missing if fewer than two |
PROC MEANS STD (or STDDEV) keyword |
Down the observations of each analysis variable | Sample standard deviation, the square root of the variance |
PROC MEANS STDERR keyword |
Down the observations | Standard error of the mean; computed only when VARDEF=DF (the default), otherwise missing |
PROC IML and FedSQL STD |
Per column / aggregate | Separate implementations documented on their own SAS pages; not the same as the DATA step function |
The standard deviation describes spread in your data. The standard error describes uncertainty of the mean; do not report one when you mean the other. For the spreadsheet equivalents of these ideas, see Excel statistics functions, and for the difference between population and sample variance see how to find population variance.
Access SAS
Use SAS from your institution, or use SAS OnDemand for Academics, which SAS describes as a free cloud-based learning environment for students, educators and independent learners. You sign up through the “Access now” option at welcome.oda.sas.com and need a SAS profile. It includes SAS Studio, a browser-based interface for writing programs, and SAS Enterprise Guide, a point-and-click interface. See the SAS page listed under Sources for current terms.
Step-by-step: STD function and PROC MEANS
Row-wise standard deviation with the STD function
- Open a program editor (for example, SAS Studio).
- Write a DATA step that calls the function. These are the documentation’s own examples:
data _null_; x1 = std(2,6); x2 = std(2,6,.); x3 = std(2,4,6,3,1); x4 = std(of x1-x3); put x1= x2= x3= x4=; run; - Run the step and read the log. The documentation shows
x1as 2.8284271247,x3as 1.9235384062 andx4as 0.5224377453. Thex2call includes a missing value, which is ignored because only nonmissing arguments are used. - For your own data, list the variables, for example
sd_score = std(of q1-q10);, to get a per-participant standard deviation across q1 to q10.
Column-wise standard deviation with PROC MEANS
- Run
proc means data=mydata; var score; run;, replacing the data set and variable names with yours. - With no statistics keywords, PROC MEANS reports N, mean, standard deviation, minimum and maximum (also documented in Penn State’s STAT 480 course notes).
- To request specific statistics, name them, for example
proc means data=mydata n mean std stderr; var score; run;. Naming keywords replaces the default list, so include every statistic you want. - Add a
classorbystatement to get a standard deviation per group.
Output and how to read it
PROC MEANS prints one row per analysis variable (or per group) with the statistics you requested. The structure is: variable name, N, mean, standard deviation, minimum and maximum. Read the standard deviation next to the mean: it is in the same units as the variable. The STD function writes its result to a variable in the data set (or the log with put), so check it row by row. For reporting conventions, see APA statistics reporting.
Troubleshooting
The result is missing
The STD function needs at least two nonmissing arguments. A row with one valid value, or none, returns a missing value by design.
STD and STDERR give different numbers
They measure different things: STDERR is the standard error of the mean, which is smaller than the standard deviation when n is greater than one. Confirm which keyword you requested.
Divisor and VARDEF
PROC MEANS uses VARDEF= to set the variance divisor; the default is DF (degrees of freedom). STDERR, CLM, LCLM, UCLM, T and PRT require VARDEF=DF; with another setting those statistics are missing.
Free alternatives
| Tool | Standard deviation | Note |
|---|---|---|
| R | sd() |
Sample standard deviation |
| Python (NumPy) | numpy.std |
See NumPy std for the divisor setting |
| SAS OnDemand for Academics | Same SAS code as above | Free learning environment from SAS |
For a comparison of R and SAS as research tools, see R vs SAS.
FAQ
What is SAS used for in statistics?
SAS is a statistical analysis software environment used for data management, descriptive statistics, modelling and reporting. Its functions and procedures, such as STD and PROC MEANS, cover descriptive statistics. See SAS statistical software and ANOVA in SAS.
Is SAS still relevant in 2026?
SAS remains in use in teaching and in analysis workflows that already rely on it, and SAS offers a free learning environment. Whether it fits your project depends on the tools your institution supports; the overview is in SAS statistical software.
Is SAS similar to Python?
Both can compute the same descriptive statistics, but the style differs: SAS uses DATA steps and procedures, Python uses libraries such as NumPy. Check the divisor each tool uses before comparing results.
What does SAS mean in jobs?
In analytics job postings, SAS normally refers to this statistical software and the programming skills used with it. It is unrelated to other uses of the abbreviation.
Sources
- SAS, STD Function, SAS 9.3 Functions and CALL Routines: Reference, read 2026-11-07.
- SAS, PROC MEANS keywords and formulas, read 2026-11-07.
- Penn State, STAT 480 course notes, read 2026-11-07.
- SAS, SAS OnDemand for Academics, read 2026-11-07.







