BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jmpalumbNCSU
Calcite | Level 5

Hey all, I'm a new-ish user to SAS (Enterprise Guide is my environment and I import code from notepad). I'm cleaning up some data output of patient records from my hospital system (RedCap, for what it's worth)  and in my proc means, I have a fairly long width column that corresponds to a survey question. Some of them are long sentence fragments and as I'm cleaning data (missing, malformed, entered wrong, etc) and it would make my life a but easier if I could make the character limit on my Label column short enough so that the error codes and variable names are both visible without side scrolling. Do I need to add label and format statements to my code or is there an easier way to transcribe my data?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You can temporarily change the default label for a single run of a procedure by using a label statement in the procedure.

 

Suppose you have a variable named VarX with a label like "This variable has a moderately long description that I don't want to show the entire text". Then you could use:

Proc means data=have;
     var Varx;
     label Varx ="Shorter label for VarX";
run; 

You might also try temporarily setting the System option to NOLABEL to suppress use of labels temporarily. Then only the variable names would be shown in the output.

options NOLABEL;
Proc means data=have;
     var Varx;
run; 

options LABEL;

But if you many somewhat obtuse variable names this may not be viable.

View solution in original post

1 REPLY 1
ballardw
Super User

You can temporarily change the default label for a single run of a procedure by using a label statement in the procedure.

 

Suppose you have a variable named VarX with a label like "This variable has a moderately long description that I don't want to show the entire text". Then you could use:

Proc means data=have;
     var Varx;
     label Varx ="Shorter label for VarX";
run; 

You might also try temporarily setting the System option to NOLABEL to suppress use of labels temporarily. Then only the variable names would be shown in the output.

options NOLABEL;
Proc means data=have;
     var Varx;
run; 

options LABEL;

But if you many somewhat obtuse variable names this may not be viable.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 1 reply
  • 1553 views
  • 0 likes
  • 2 in conversation