20.2 C
London
Sunday, June 22, 2025
HomeSASData Munging in SASHow to Remove Variable Labels in SAS (With Examples)

How to Remove Variable Labels 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 following methods to remove variable labels in SAS:

Method 1: Remove Label from One Variable

proc datasets lib=work;
  modify original_data;
  attrib my_variable label='';

Method 2: Remove Label from All Variables

proc datasets lib=work;
  modify original_data;
  attrib _all_ label='';

The following examples show how to use each method in practice with the following dataset that has three variables with a label for each variable:

/*create dataset*/
data original_data;
   label x='REBOUNDS'
         y='POINTS'
         z='ASSISTS';
   input x y z;
datalines;
6 22 5
8 14 9
9 31 10
9 40 7
3 12 3
2 20 5
;

/*view contents of dataset*/
proc contents data=original_data;

Example 1: Remove Label from One Variable

The following code shows how to use proc datasets to remove the label from just the variable called ‘x’ in our dataset:

proc datasets lib=work;
  modify original_data;
  attrib x label='';

Notice that the label has been removed from variable x while the other variables in the dataset have remained unchanged.

Example 2: Remove Label from All Variables

The following code shows how to use proc datasets to remove the label from all variables in the dataset:

proc datasets lib=work;
  modify original_data;
  attrib _all_ label='';

Notice that the labels for all of the variables in the dataset have been removed.

Note: You can find the complete documentation for proc datasets here.

Additional Resources

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

How to Normalize Data in SAS
How to Identify Outliers in SAS
How to Extract Numbers from String in SAS
How to Remove Leading Zeros 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