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.zipInstalls 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.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
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:
- Identify which variables are unordered categorical.
- List them in the CLASS statement. Specify
ref=for each if you want a specific reference group. - Include them in the MODEL statement like any other variable.
- Add
/solution clparmto the MODEL statement. Without this, you get ANOVA-style output only, no regression coefficients. - Interpret output: each class level coefficient is the difference from the reference group, same as manually-coded dummies.
For PROC REG with categorical variables:
- Create k-1 binary dummy variables for each k-level categorical variable.
- Choose which category to exclude (the reference).
- Include all k-1 dummies in the MODEL statement.
- 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
| Feature | PROC REG | PROC GLM |
|---|---|---|
| Categorical variable handling | Manual dummy coding required | CLASS statement, automatic |
| Regression coefficients shown by default | Yes | No, requires /solution clparm |
| Setting reference category | Exclude that dummy | ref= option in CLASS statement |
| Interaction terms | Harder to specify | Easier with ` |
| Regression diagnostics | Comprehensive | Limited |
| Best for | Diagnostics-heavy models, all-numeric predictors | Models 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.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| proc-reg-vs-proc-glm-sas (this skill) | 0 | 2mo | No flags | Intermediate |
| streamlit | 86 | 9mo | No flags | Intermediate |
| jupyter-notebook | 30 | 6mo | Review | Intermediate |
| backtesting-frameworks | 17 | 2mo | No flags | Advanced |
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
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.
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.
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.
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.
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.