Published on :
Reporting SASHELP

Display class data filtered by gender

This code is also available in: Deutsch Español Français
The script sets a dynamic title using the `&gender` macro variable. It then executes a `PRINT` procedure on the `sashelp.class` dataset, applying a `WHERE` filter to select only records where the `sex` column matches the value of `&gender`.
Data Analysis

Type : SASHELP


Uses the standard SASHELP.CLASS example dataset.

1 Code Block
PROC PRINT
Explanation :
Displays filtered data with a dynamic title. The WHERE clause restricts results based on the &gender macro variable's value.
Copied!
1Title "Display class data for &gender";
2PROC PRINT DATA=sashelp.class;
3 where sex="&gender";
4RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.