PR

proc-reg-vs-proc-glm-sas

Guides the choice between PROC REG and PROC GLM in SAS.

Install

mkdir -p .claude/skills/proc-reg-vs-proc-glm-sas && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14939" && unzip -o skill.zip -d .claude/skills/proc-reg-vs-proc-glm-sas && rm skill.zip

Installs to .claude/skills/proc-reg-vs-proc-glm-sas

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Use when choosing between PROC REG and PROC GLM in SAS for running a linear regression, particularly when your model includes categorical predictors or interaction terms.
170 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Choose between PROC REG and PROC GLM for linear regression in SAS
  • Run linear regression with all numeric predictors using PROC REG
  • Handle categorical predictors in linear regression using PROC GLM
  • Specify reference categories for categorical variables in PROC GLM
  • Obtain regression coefficients and confidence intervals from PROC GLM
  • Perform detailed regression diagnostics with PROC REG

How it works

The skill clarifies the use cases for PROC REG and PROC GLM in SAS for linear regression, detailing how each procedure handles categorical variables and diagnostics. It provides code examples and explains the necessary options for obtaining desired outputs.

Inputs & outputs

You give it
SAS dataset, model specification (dependent and independent variables)
You get back
Regression coefficients, ANOVA tables, diagnostic plots

When to use proc-reg-vs-proc-glm-sas

  • Select SAS regression procedure
  • Handle categorical variables
  • Run linear regression
  • Perform diagnostic analysis

About this skill

Overview

Both PROC REG and PROC GLM fit linear regression models. The difference is how they handle categorical variables and what diagnostics they provide. Choosing the wrong one creates extra work or missing output.

Short version: PROC REG is more powerful for diagnostics, requires manual dummy coding. PROC GLM handles categorical variables natively, makes interaction terms easier.

When to Use

  • Use PROC REG when you need detailed regression diagnostics (residual plots, influence statistics, VIF) or when all your predictors are already numeric.
  • Use PROC GLM when you have unordered categorical variables and don't want to manually create dummy variables, or when you need interaction terms.

Core Pattern

PROC REG:

proc reg data=analytic;
  model BPXSY1 = age bmi gender widowed divorced separated never_married living_partner;
run;

Outputs regression coefficients by default. All variables must be numeric. Categorical variables need manual dummy coding before this step.

PROC GLM:

proc glm data=analytic;
  class DMDMARTL(ref='1') gender;
  model BPXSY1 = age bmi gender DMDMARTL / solution clparm;
run;

The CLASS statement tells SAS which variables are categorical. SAS creates the dummies internally. The ref= option sets the reference category. The /solution clparm options are required to see the regression coefficients and confidence intervals, which are NOT shown by default.

Step-by-Step Process

For PROC GLM with categorical variables:

  1. Identify which variables are unordered categorical.
  2. List them in the CLASS statement. Specify ref= for each if you want a specific reference group.
  3. Include them in the MODEL statement like any other variable.
  4. Add /solution clparm to the MODEL statement. Without this, you get ANOVA-style output only, no regression coefficients.
  5. Interpret output: each class level coefficient is the difference from the reference group, same as manually-coded dummies.

For PROC REG with categorical variables:

  1. Create k-1 binary dummy variables for each k-level categorical variable.
  2. Choose which category to exclude (the reference).
  3. Include all k-1 dummies in the MODEL statement.
  4. Coefficients appear automatically.

Judgment & Heuristics

If you need serious diagnostics, use PROC REG. It has built-in options for outlier detection, Cook's D, leverage, VIF for multicollinearity, and residual plots. PROC GLM's diagnostics are limited by comparison.

If you have categorical variables and don't need advanced diagnostics, PROC GLM is less error-prone. Manual dummy coding works, but forgetting a level or miscoding a reference group is a real risk. Let SAS handle it.

PROC GLM is better for interactions. Adding an interaction between a continuous and a categorical variable (or two categoricals) is cleaner with the CLASS statement and the | operator in the MODEL statement.

The /solution option is easy to forget in PROC GLM. Without it, you get F-tests and sums of squares but no parameter estimates. Not useful for most regression work.

Both produce the same estimates when coded correctly. This is a good sanity check. If you build the same model in both procedures and get different coefficients, something went wrong in your dummy coding.

Common Mistakes

  • Running PROC GLM without /solution clparm. You'll see the ANOVA table but no regression coefficients.
  • Not specifying ref= in the CLASS statement. SAS defaults to the last (alphabetically or numerically) category as reference. This may not be what you want.
  • Including a categorical variable in PROC REG without creating dummies. SAS will treat it as numeric, implying an ordering and equal spacing that doesn't exist.
  • Creating dummies in PROC REG but also listing the original variable. Don't include both the original categorical variable and its dummies in the same model.
  • Expecting the same diagnostic output from both procedures. PROC REG has more. Plan your analysis accordingly.

Quick Reference

FeaturePROC REGPROC GLM
Categorical variable handlingManual dummy coding requiredCLASS statement, automatic
Regression coefficients shown by defaultYesNo, requires /solution clparm
Setting reference categoryExclude that dummyref= option in CLASS statement
Interaction termsHarder to specifyEasier with `
Regression diagnosticsComprehensiveLimited
Best forDiagnostics-heavy models, all-numeric predictorsModels with categorical vars or interactions

When not to use it

  • When performing non-linear regression analysis
  • When using statistical software other than SAS

Limitations

  • Focuses on linear regression models

How it compares

This skill provides a comparative guide for two SAS procedures, PROC REG and PROC GLM, specifically addressing their strengths and weaknesses for linear regression with categorical variables, which helps users select the appropriate tool mo

Compared to similar skills

proc-reg-vs-proc-glm-sas side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
proc-reg-vs-proc-glm-sas (this skill)02moNo flagsIntermediate
streamlit869moNo flagsIntermediate
jupyter-notebook306moReviewIntermediate
backtesting-frameworks172moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

streamlit

sverzijl

When working with Streamlit web apps, data dashboards, ML/AI app UIs, interactive Python visualizations, or building data science applications with Python

86239

jupyter-notebook

davila7

Use when the user asks to create, scaffold, or edit Jupyter notebooks (`.ipynb`) for experiments, explorations, or tutorials; prefer the bundled templates and run the helper script `new_notebook.py` to generate a clean starting notebook.

30158

backtesting-frameworks

wshobson

Build robust backtesting systems for trading strategies with proper handling of look-ahead bias, survivorship bias, and transaction costs. Use when developing trading algorithms, validating strategies, or building backtesting infrastructure.

17126

pdf-processing-pro

davila7

Production-ready PDF processing with forms, tables, OCR, validation, and batch operations. Use when working with complex PDF workflows in production environments, processing large volumes of PDFs, or requiring robust error handling and validation.

17110

llava

zechenzhangAGI

Large Language and Vision Assistant. Enables visual instruction tuning and image-based conversations. Combines CLIP vision encoder with Vicuna/LLaMA language models. Supports multi-turn image chat, visual question answering, and instruction following. Use for vision-language chatbots or image understanding tasks. Best for conversational image analysis.

7117

cocoindex

cocoindex-io

Comprehensive toolkit for developing with the CocoIndex library. Use when users need to create data transformation pipelines (flows), write custom functions, or operate flows via CLI or API. Covers building ETL workflows for AI data processing, including embedding documents into vector databases, building knowledge graphs, creating search indexes, or processing data streams with incremental updates.

6116

Search skills

Search the agent skills registry