SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
K_S
Quartz | Level 8 K_S
Quartz | Level 8

How do I label in a practical way a bunch of vars that have the same prefix and need the same label.

 

Structure of database:

id   col1 col2 col3 col4 col5...…...col72

 

I want all col  vars to be called "Supercalifragilisticexpialidocious";

Is there a very to do this very easily?

4 REPLIES 4
PaigeMiller
Diamond | Level 26

A macro could do this. But, what is the value of having 72 variables having the same label? Why put in the effort, what do you gain?

--
Paige Miller
K_S
Quartz | Level 8 K_S
Quartz | Level 8

any other way?

I am not too good with macros.

 

PaigeMiller
Diamond | Level 26

@K_S wrote:

any other way?

I am not too good with macros.


Maybe there's a method using PROC TRANSPOSE, but I will leave that to others. The only other way I know of is to type in the labels for all 72 variables.

--
Paige Miller
FreelanceReinh
Jade | Level 19

Hello @K_S,

 

Use the ATTRIB statement in PROC DATASETS:

proc datasets lib=your_libref nolist;
modify your_dataset;
attrib col: label='your label';
quit;

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1032 views
  • 1 like
  • 3 in conversation