Published on :
Reporting EXTERNE

Conference Data Analysis

This code is also available in: Español Français
The script begins by assigning an external library 'ch4' to a specified data path. It then proceeds with several analyses: 1) counting participants by registration type (RegType), 2) creating and applying a custom format for the 'VegMeal' variable to display 'Yes'/'No' in a detailed report, 3) calculating total fees by regional code (AreaCode) and registration type with monetary formatting, 4) a cross-frequency analysis for the total number and percentage of participants by 'AreaCode' and 'RegType' via PROC FREQ, and 5) a repetition of the previous analysis using PROC TABULATE for the same statistics.
Data Analysis

Type : EXTERNE


Data is read from the 'conference' table in the 'ch4' library. This library is defined by a LIBNAME statement pointing to a specified external local file directory: 'U:\Little-SAS-Book-Exercises-And-Projects\data\EPLSB5data\Chapter4_data'.

1 Code Block
LIBNAME
Explanation :
This statement defines the SAS library 'ch4' and associates it with the specified file path. This allows the script to access SAS datasets (.sas7bdat) stored in this directory, notably 'ch4.conference'.
Copied!
1LIBNAME ch4 "U:\Little-SAS-Book-Exercises-And-Projects\
2DATA\EPLSB5data\Chapter4_data";
3 
2 Code Block
PROC TABULATE
Explanation :
This procedure generates a summary table (Part A) that counts the total number of participants for each unique value of the 'RegType' variable (Registration Type) present in the 'ch4.conference' dataset.
Copied!
1PROC TABULATE DATA = ch4.conference;
2 CLASS RegType;
3 TABLES RegType;
4RUN;
3 Code Block
PROC FORMAT
Explanation :
This block creates a custom format named 'needsveg'. It is designed to map numeric values 0 and 1 of the 'VegMeal' variable to the character strings 'No' and 'Yes' respectively, thereby improving readability in reports.
Copied!
1PROC FORMAT;
2 VALUE needsveg
3 0 = "No"
4 1 = "Yes"
5 ;
6RUN;
4 Code Block
PROC PRINT
Explanation :
Displays a list of conference participants (First Name, Last Name) as well as their vegetarian meal requirement ('VegMeal'). The 'needsveg' format is applied to 'VegMeal' to display 'Yes' or 'No'. A descriptive title is added to the report.
Copied!
1PROC PRINT DATA = ch4.conference;
2 VAR FirstName LastName VegMeal;
3 FORMAT VegMeal needsveg.;
4 TITLE "Meal Requirements for Conference Participants";
5RUN;
5 Code Block
PROC TABULATE
Explanation :
This procedure generates a cross-table (Part C) presenting the sum of fees ('Rate') by regional code ('AreaCode') and registration type ('RegType'). The output is formatted in dollars with two decimal places for better financial presentation.
Copied!
1PROC TABULATE DATA = ch4.conference FORMAT = DOLLAR9.2;
2 CLASS AreaCode RegType;
3 VAR Rate;
4 TABLE AreaCode, SUM=''*Rate=''*RegType="Registration Type";
5 TITLE "Total Fees Collected Per Area Code and Registration Type";
6RUN;
6 Code Block
PROC FREQ
Explanation :
Creates a cross-frequency table (Part D) for 'AreaCode' and 'RegType'. The LIST option displays each category combination on a separate line, and NOCUM suppresses cumulative percentages, focusing on individual totals and percentages.
Copied!
1PROC FREQ DATA = ch4.conference;
2 TABLES AreaCode * RegType /
3 LIST NOCUM;
4 TITLE "Total and Percent Attendees by Area Code and Registration Type with PROC FREQ";
5RUN;
7 Code Block
PROC TABULATE
Explanation :
This block uses PROC TABULATE (Part E) to reproduce the analysis from Part D. It calculates the total number of participants (N) and their overall percentage (PCTN) by 'AreaCode' and 'RegType', offering an alternative and flexible method for presenting statistics.
Copied!
1PROC TABULATE DATA = ch4.conference;
2 CLASS AreaCode RegType;
3 TABLE AreaCode, N='Total Count'*RegType='Registration Type' PCTN='Overall Percentage'*RegType='Registration Type';
4 TITLE "Total and Percent Attendees by Area Code and Registration Type with PROC TABULATE";
5RUN;
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.