How to delete labels and formats from SAS variables?

To delete labels and formats from SAS variables, use the PROC DATASET  procedure and attrib statement. Consider the example dataset ex with label and formats applied.

data ex;
	a=10.3;
	b=20.5;
	attrib a format=dollar10.2 label='VARIABLE A' b format=dollar10.2 
		label='VARIABLE B';
run;

How to delete labels and formats form a variable?

To delete a variable label and format, use the PROC DATASETS procedure as below.

proc datasets lib=work memtype=data;
	modify ex;
	attrib a label=' ';
	attrib a format='';
	run;
quit;

ods select Variables;
proc contents data=ex;
run;
ods select default;

How to delete labels and formats form a variable?

To delete labels and formats from all the variables replace the attrib statement as below.

attrib _all_ label=' ';
attrib _all_ format='';

Every week we'll send you SAS tips and in-depth tutorials

JOIN OUR COMMUNITY OF SAS Programmers!

Subhro Kar is an Analyst with over five years of experience. As a programmer specializing in SAS (Statistical Analysis System), Subhro also offers tutorials and guides on how to approach the coding language. His website, 9to5sas, offers students and new programmers useful easy-to-grasp resources to help them understand the fundamentals of SAS. Through this website, he shares his passion for programming while giving back to up-and-coming programmers in the field. Subhro’s mission is to offer quality tips, tricks, and lessons that give SAS beginners the skills they need to succeed.