Table of Contents
SAS (Statistical Analysis System) is a powerful software used for data analysis and management. It allows users to assign labels to variables for better organization and understanding of the data. However, there may be instances when the variable labels need to be removed. This can be achieved through the use of the LABEL statement in the DATA step.
To remove variable labels in SAS, the LABEL statement can be used with the option “NULL”. For example, if the variable “Age” has the label “Participant Age”, the following code can be used:
DATA dataset;
SET dataset;
LABEL Age=NULL;
RUN;
This will remove the label “Participant Age” from the variable “Age”. Multiple variables can also be specified in the LABEL statement to remove their labels simultaneously.
In addition, the LABEL statement can also be used to change or modify existing labels. For example, the following code will change the label of the variable “Gender” from “Participant Gender” to “Participant Sex”:
LABEL Gender=”Participant Sex”;
In conclusion, the LABEL statement in SAS provides a simple and efficient way to remove or modify variable labels, allowing users to easily manage and analyze their data.
Remove Variable Labels in SAS (With Examples)
You can use the following methods to remove variable labels in SAS:
Method 1: Remove Label from One Variable
proc datasetslib=work;
modify original_data;
attrib my_variable label='';
Method 2: Remove Label from All Variables
proc datasetslib=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 contentsdata=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 datasetslib=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 datasetslib=work;
modify original_data;
attrib _all_ label='';
Note: You can find the complete documentation for proc datasets .
The following tutorials explain how to perform other common tasks in SAS:
Cite this article
stats writer (2024). How do you remove variable labels in SAS? Provide examples.. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-do-you-remove-variable-labels-in-sas-provide-examples/
stats writer. "How do you remove variable labels in SAS? Provide examples.." PSYCHOLOGICAL SCALES, 26 Jun. 2024, https://scales.arabpsychology.com/stats/how-do-you-remove-variable-labels-in-sas-provide-examples/.
stats writer. "How do you remove variable labels in SAS? Provide examples.." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-do-you-remove-variable-labels-in-sas-provide-examples/.
stats writer (2024) 'How do you remove variable labels in SAS? Provide examples.', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-do-you-remove-variable-labels-in-sas-provide-examples/.
[1] stats writer, "How do you remove variable labels in SAS? Provide examples.," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How do you remove variable labels in SAS? Provide examples.. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
