3.1 C
London
Friday, December 20, 2024
HomeSASData Munging in SASHow to Add Titles in SAS (With Examples)

How to Add Titles in SAS (With Examples)

Related stories

Learn About Opening an Automobile Repair Shop in India

Starting a car repair shop is quite a good...

Unlocking the Power: Embracing the Benefits of Tax-Free Investing

  Unlocking the Power: Embracing the Benefits of Tax-Free Investing For...

Income Splitting in Canada for 2023

  Income Splitting in Canada for 2023 The federal government’s expanded...

Can I Deduct Home Office Expenses on my Tax Return 2023?

Can I Deduct Home Office Expenses on my Tax...

Canadian Tax – Personal Tax Deadline 2022

  Canadian Tax – Personal Tax Deadline 2022 Resources and Tools...

You can use the title statement in SAS to quickly add a title to a table or chart.

This statement uses the following basic syntax:

Method 1: Add One Title

/*define title*/
title "This is a title";

/*view dataset with title*/
proc print data=my_data;

Method 2: Add Multiple Titles

/*define titles*/
title1 color="purple" height=25pt bold italic underline=1 "This is a Title";
title2 font="Helvetica" justify=left height=18pt "Second Title";
title3 color="green" justify=right height=14pt "Third Title";

/*view dataset with title*/
proc print data=my_data;

Note the following statements that you can use to modify the titles:

  • color: The font color
  • height: The font size
  • font: The font family
  • justify: The location of the title (left, right, center)
  • style: Use “bold”, “italic”, or “underlin” to modify the font style

The following examples show how to use each method in practice.

Example 1: Add One Title

The following code shows how to add one title to a dataset in SAS:

/*create dataset*/
data original_data;
    input team $ points rebounds;
    datalines;
A 25 10
A 18 4
B 27 9
B 33 13
;
run;

/*view dataset*/
title "This is a title";
proc print data=original_data;

sas add a title

Example 2: Add Multiple Titles

The following code shows how to add multiple titles with custom designs to a dataset in SAS:

/*create dataset*/
data original_data;
    input team $ points rebounds;
    datalines;
A 25 10
A 18 4
B 27 9
B 33 13
;
run;

/*view dataset*/
title1 color="purple" height=25pt bold italic underlin=1 "First Title";
title2 font="Helvetica" justify=left height=18pt "Second Title";
title3 color="green" justify=right height=14pt "Third Title";
proc print data=original_data;

Note that you can use the title1, title2, title3, etc. syntax to add up to 10 lines of titles to a chart or table.

Additional Resources

The following tutorials explain how to perform other common tasks in SAS:

How to Use Proc Summary in SAS
How to Use Proc Tabulate in SAS
How to Create Frequency Tables in SAS

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories