PROC in SAS

This comprehensive Q&A-style guide about PROC in SAS Software breaks down fundamental SAS PROCs used in statistical analysis and data management. Learn:
What PROCs do and their key functions.
Differences between PROC MEANS & SUMMARY.
When to use PROC MIXED for mixed-effects models.
CANCORR vs CORR for multivariate vs bivariate analysis.
Sample PROC MIXED code with required statements.
How PROC PRINT & CONTENTS help inspect data.

Ideal for students learning SAS Programming and statisticians performing advanced analyses. Includes ready-to-use code snippets and easy comparisons!

Q&A PROC in SAS Software

Explain the functions of PROC in SAS.

PROC (Procedure) is a fundamental component of SAS programming that performs specific data analysis, reporting, or data management tasks. Each PROC is a pre-built routine designed to handle different statistical, graphical, or data processing operations. The key functions of PROC in SAS are:

  • Data Analysis & Statistics: PROCs perform statistical computations, including:
    • Descriptive Statistics (PROC MEANS, PROC SUMMARY, PROC UNIVARIATE)
    • Hypothesis Testing (PROC TTEST, PROC ANOVA, PROC GLM)
    • Regression & Modeling (PROC REG, PROC LOGISTIC, PROC MIXED)
    • Multivariate Analysis (PROC FACTOR, PROC PRINCOMP, PROC DISCRIM)
  • Data Management & Manipulation
    • Sorting (PROC SORT)
    • Transposing Data (PROC TRANSPOSE)
    • Merging & Combining Datasets (PROC SQL, PROC APPEND)
  • Reporting & Output Generation
    • Printing Data (PROC PRINT)
    • Creating Summary Reports (PROC TABULATE, PROC REPORT)
    • Generating Graphs (PROC SGPLOT, PROC GCHART)
  • Quality Control & Data Exploration
    • Checking Data Structure (PROC CONTENTS)
    • Identifying Missing Data (PROC FREQ with MISSING option)
    • Sampling Data (PROC SURVEYSELECT)
  • Advanced Analytics & Machine Learning
    • Cluster Analysis (PROC CLUSTER)
    • Time Series Forecasting (PROC ARIMA)
    • Text Mining (PROC TEXTMINER)

    PROCs are the backbone of SAS programming, enabling data analysis, manipulation, and reporting with minimal coding. Choosing the right PROC depends on the task—whether it’s statistical modeling, data cleaning, or generating business reports.

    Explain the Difference Between PROC MEANS and PROC SUMMARY.

    Both PROC MEANS and PROC SUMMARY in SAS compute descriptive statistics (e.g., mean, sum, min, max), but they differ in default behavior and output:

    • Default Output
      PROC MEANS: Automatically prints results in the output window.
      PROC SUMMARY: Does not print by default; requires the PRINT option.
    • Dataset Creation
      Both can store results in a dataset using OUT=.
    • Handling of N Observations
      PROC MEANS: Includes a default N (count) statistic.
      PROC SUMMARY: Requires explicit specification of statistics.
    • Usage Context
      Use PROC MEANS for quick interactive analysis.
      Use PROC SUMMARY for programmatic, non-printed summaries.

    The PROC MEANS is more user-friendly for direct analysis, while PROC SUMMARY in SAS offers finer control for automated reporting.

    Under the PROC MEANS, there is only a subgroup that is created only when there is a BY statement that is being used, and the input data is previously well-sorted out with the help of BY variables.

    Under the PROC SUMMARY in SAS, there is a statistic that gets produced automatically for all the subgroups. It gives all sorts of information that runs together.

    Introduction to PROC in SAS Software

    What is the PROC MIXED Procedure in SAS STAT used for?

    The PROC blended system in SAS/STAT fits specific blended models. The Mixed version can allow for one-of-a-kind assets of variation in information, it allows for one-of-a-kind variances for corporations, and takes into account the correlation structure of repeated measurements.

    PROC MIXED is essential for analyzing data with correlated observations or hierarchical structures. Its flexibility in modeling random effects and covariance makes it a cornerstone of advanced statistical analysis in SAS.

    PROC MIXED is a powerful SAS procedure for fitting linear mixed-effects models, which account for both fixed and random effects in data. It is widely used for analyzing hierarchical, longitudinal, or clustered data where observations are correlated (e.g., repeated measures, multilevel data).

    What is the Difference Between CANCORR and CORR Procedures in SAS STAT?

    Both procedures analyze relationships between variables, but they serve distinct purposes:

    1. PROC CORR (Correlation Analysis): Computes simple pairwise correlations (e.g., Pearson, Spearman). It is used to examine linear associations between two or more variables or when there is no distinction between dependent/independent variables. The output from different statistical software is in the form of the correlation matrix, p-values, and descriptive statistics. The code below tests how height, weight, and age are linearly related.

      PROC CORR DATA=my_data;
      VAR height weight age;
      RUN;
    2. PROC CANCORR (Canonical Correlation Analysis): Analyzes multivariate relationships between two sets of variables. It is used to find linear combinations (canonical variables) that maximize correlation between sets.
      It is also useful for dimension reduction (e.g., linking psychological traits to behavioral measures). The output from different statistical software is Canonical correlations, coefficients, and redundancy analysis.

      PROC CANCORR DATA=my_data;
      VAR set1_var1 set1_var2; /* First variable set */
      WITH set2_var1 set2_var2; /* Second variable set */
      RUN;

    Key Differences Summary

    FeaturePROC CORRPROC CANCORR
    Analysis TypeBivariate correlationsMultivariate (set-to-set)
    VariablesSingle list (no grouping)Two distinct sets (VAR & WITH)
    Output FocusPairwise coefficients (e.g., r)Canonical correlations (ρ)
    ComplexitySimple, descriptiveAdvanced, inferential

    Write a sample program using the PROC MIXED procedure, including all the required statements

    proc mixed data=SASHELP.IRIS plots=all;
    class species;
    model petallength= /;
    run;

    Describe what PROC PRINT and PROC CONTENTS are used for.

    PROC contents displays the information about an SAS dataset, while PROC print ensures that the data is correctly read into the SAS dataset.

    1. PROC CONTENTS: Displays metadata about a SAS dataset (structure, variables, attributes). Its key uses are:
    • Check variable names, types (numeric/character), lengths, and formats.
    • Identify dataset properties (e.g., number of observations, creation date).
    • Debug data import/export issues (e.g., mismatched formats).

    The general syntax of PROC CONTENTS is

    PROC CONTENTS DATA=your_data;  
    RUN;
    1. PROC PRINT: Displays raw data from a SAS dataset to the output window. Its key uses are:
    • View actual observations and values.
    • Verify data integrity (e.g., missing values, unexpected codes).
    • Quick preview before analysis.

    The general Syntax of PROC PRINT is

    PROC PRINT DATA=your_data (OBS=10);  /* Prints first 10 rows */ 
       VAR var1 var2;                                              /* Optional: limit columns */
    RUN;

    Functions in R Programming

    Functions in SAS

    The post is about Functions in SAS Software. Functions in SAS software are predefined routines that perform specific computations or transformations on data. They can be categorized into several types based on their functionality.

    Introduction to Functions in SAS Software

    SAS functions are predefined operations that perform specific computations on data, categorized by their purpose. Numeric functions handle mathematical calculations like rounding, summing, and logarithms. Character functions manipulate text data through substring extraction, case conversion, and concatenation. Date and time functions manage SAS date, time, and datetime values, enabling operations like extracting year/month/day or shifting dates by intervals.

    In SAS, Statistical functions compute summary metrics such as mean, median, and standard deviation. Financial functions support business calculations like net present value and loan payments. Random number functions generate values from statistical distributions for simulations. Bitwise functions perform low-level binary operations. Array functions assist in managing array dimensions and bounds. Special functions include utilities for data type conversion and lagged value retrieval. Finally, file and I/O functions check file existence and manage input/output operations. Together, these functions streamline data processing, analysis, and reporting in SAS.

    Here are the main types of functions in SAS Software:

    Numeric Functions

    Perform mathematical operations on numeric values. These functions are also called arithmetic functions.

    FunctionShort Description
    SUM()Sum of arguments
    MEAN()Arithmetic mean
    MIN() / MAX()Minimum/Maximum value
    ROUND()Rounds a number
    INT()Returns integer part of a number
    ABS()Absolute value of the argument
    SQRT()Square root
    LOG() / LOG10()Returns the integer part of a number
    Functions in SAS Software

    Random Number Functions in SAS

    These functions generate random numbers.

    Random Number FunctionShort Description
    RANUNI()Generates random numbers from Uniform distribution
    RANNOR()Generates random numbers from a Normal distribution
    RANBIN()Generates random numbers from a Binomial distribution

    Financial Functions

    The following are important and useful financial calculations.

    Financial FunctionsShort Description
    IRR()Internal rate of return
    NPV()Returns Net Present Value
    PMT()Loan payment calculation

    Character Functions in SAS

    Manipulate and analyze text (string) data. These functions can also be classified as character-handling functions.

    Character FunctionsShort Description
    SUBSTR()Extracts a substring from an argument
    SCAN()Extracts a specified word from a string
    TRIM() / STRIP()Removes trailing/leading blanks from character expression
    UPCASE() / LOWCASE()Converts to uppercase/lowercase
    CATX()Concatenates strings with a delimiter
    INDEX()Finds the position of a
    COMPRESS()Removes specific characters from a string

    Statistical Functions

    The following are some important functions for the computation of descriptive statistical measures.

    Descriptive FunctionsShort Description
    MEAN(), MEDIAN(), MODE()Returns measures of central tendencies, mean, median, and mode of the data
    STD()Returns standard deviation
    VAR()Returns the variance
    N()Returns the count of non-missing values
    NMISS()Returns the count of missing values

    Date and Time Functions in SAS

    These functions handle SAS date, time, and datetime values.

    FunctionsShort Description
    TODAY() / DATE()Returns the current date
    MDY()Creates a date from month, day, year
    YEAR() / MONTH() / DAY()Extracts year/month/day
    INTCK()Computes intervals between dates
    INTNX()Increments a date by intervals
    DATEPART()Extracts the date from datetime
    TIMEPART()Extracts time from datetime

    Bitwise Functions

    The following functions perform bit-level operations.

    FunctionsShort Description
    BAND()Bitwise AND
    BOR()Bitwise OR
    BNOT()Bitwise NOT

    Array Functions

    The following functions work with arrays.

    FunctionsShort Description
    DIM()Returns the size of an array
    HBOUND() / LBOUND()Returns upper/ lower bounds of an array

    Special Functions

    Miscellaneous operations. These functions may be classified as conversion functions, too.

    FunctionsShort Description
    INPUT()Converts character to numeric/ date
    PUT()Converts value to formatted text
    LAG() / DIF()Access previous row values

    File and I/O Functions

    These functions handle file operations.

    FunctionsShort Description
    FILEEXIST()Checks if a file exists
    FEXIST()Checks if a fileref exists

    The SAS functions described above help us in data cleaning, transformation, and analysis in SAS programming/ Software.

    First Year (Intermediate) Mathematics Quiz

    MS Excel Visualization MCQs 13

    Test your Excel skills with this 20-question MCQ quiz on advanced data visualization! The MS Excel Visualization MCQs quiz covers key chart types like bubble charts, scatter plots, waterfall charts, hierarchy charts, population pyramids, and gauge charts—essential for effective data storytelling. Perfect for analysts, students, and professionals looking to master Excel’s powerful visualization tools. Take the MS Excel Visualization MCQs quiz now and see how well you know Excel charts!

    Online MS Excel Tables Query Quiz with Answers

    1. Before creating a hierarchy chart, the data must be arranged correctly. The first column must contain the main category.

     
     

    2. When creating a Map chart, the countries (or states or regions) need to be in alphabetical order.

     
     

    3. What type of chart is the following?

    Treemap chart in MS Excel Quiz 4

     
     
     
     

    4. Outliers in scatter or bubble charts should always be removed, and no notes need to be made to supplement your chart.

     
     

    5. How can we adjust the vertical axis in the chart below to appear on the extreme left of the chart?

    Population chart ms excel quiz

     
     
     
     

    6. To create a Population chart (population pyramid chart in demography) in Excel, we need to begin with a:

     
     
     
     

    7. What is the most likely explanation for the Map chart appearing the way below?

    Map Chart in MS excel Quiz

     
     
     

    8. If a waterfall chart is composed of data from different categories, the order of the categories will impact the shape of the waterfall in the chart.

     
     

    9. If we were to add a third set of data, which included the same three variables used to plot the graph below, where the bubble size is the company size, Excel will usually add the new data set in a new colour.

    bubble chart ms excel quiz 2 size

     
     

    10. If we re-created the chart below but did not include the main category (in the inner-most ring) and highlighted the main-sub-category as our first category instead, each country would be coloured differently.

    MS Excel Visualization Quiz Q3

     
     

    11. In Excel, what is hierarchical data?

     
     
     

    12. Why are some parts of the world shaded in grey in the Map chart below?

    map chart ms excel quiz

     
     
     

    13. How can we add a picture that is incorporated in the chart, the way it has been below?

    Chart with Picture MS Excel Quiz

     
     
     

    14. A waterfall chart is ideal for showing the cumulative impact of a series of positive and negative components.

     
     

    15. Consider the Gauge chart below. What would happen to this Combo chart if both chart elements were converted to a Doughnut?

    Gauge Chart in MS Excel

     
     
     
     

    16. Before you create a hierarchy chart, you need to organise your data by size.

     
     

    17. A bubble chart is like a scatter chart, with a third variable, and solves the problem of displaying three variables in a 2-dimensional chart.

     
     

    18. What is the likely cause of the equal-sized bubbles in this 2-D bubble chart?

    bubble chart ms excel quiz 1

     
     
     

    19. What is the following chart type?

    Funnel Chart MS Excel Quiz

     
     
     
     

    20. The key difference between the Change Colours and Themes functionalities in Excel is that Themes includes suggestions for fonts as well.

     
     

    Question 1 of 20

    Online MS Excel Visualization MCQs with Answers

    • A bubble chart is like a scatter chart, with a third variable, and solves the problem of displaying three variables in a 2-dimensional chart.
    • What is the likely cause of the equal-sized bubbles in this 2-D bubble chart?
    • Outliers in scatter or bubble charts should always be removed, and no notes need to be made to supplement your chart.
    • If we were to add a third set of data, which included the same three variables used to plot the graph below, where the bubble size is the company size, Excel will usually add the new data set in a new colour.
    • In Excel, what is hierarchical data?
    • Before creating a hierarchy chart, the data must be arranged correctly. The first column must contain the main category.
    • Before you create a hierarchy chart, you need to organise your data by size.
    • If we re-created the chart below but did not include the main category (in the inner-most ring) and highlighted the main-sub-category as our first category instead, each country would be coloured differently.
    • What type of chart is the following?
    • The key difference between the Change Colours and Themes functionalities in Excel is that Themes includes suggestions for fonts as well.
    • A waterfall chart is ideal for showing the cumulative impact of a series of positive and negative components.
    • If a waterfall chart is composed of data from different categories, the order of the categories will impact the shape of the waterfall in the chart.
    • What is the following chart type?
    • How can we add a picture that is incorporated in the chart, the way it has been below?
    • When creating a Map chart, the countries (or states or regions) need to be in alphabetical order.
    • Why are some parts of the world shaded in grey in the Map chart below?
    • What is the most likely explanation for the Map chart appearing the way below?
    • To create a Population chart (population pyramid chart in demography) in Excel, we need to begin with a:
    • Consider the Gauge chart below. What would happen to this Combo chart if both chart elements were converted to a Doughnut?
    • How can we adjust the vertical axis in the chart below to appear on the extreme left of the chart?
    MS Excel Visualization MCQs with Answers: Population chart ms excel quiz

    Python Data Visualization Quiz