DATA Step, Macro, Functions and more

Label not working in proc print

Accepted Solution Solved
Reply
Regular Contributor
Posts: 178
Accepted Solution

Label not working in proc print

data baseball(keep= name team);

set sashelp.baseball;

if team = 'Cleveland';

run;

Sample output
Allanson, Andy Cleveland
Thornton, Andre Cleveland
Butler, Brett Cleveland
Jacoby, Brook Cleveland
Bando, Chris Cleveland
Castillo, Carmen Cleveland
Snyder, Cory Cleveland
Carter, Joe Cleveland
Franco, Julio Cleveland
Hall, Mel Cleveland
Tabler, Pat Cleveland
Bernazard, Tony Cleveland

 

 

PROC PRINT DATA = baseball noobs ;

var name team;

label team = 'My Team';

RUN;

The output is not changing the team name to 'My Team'.  I researched this and I believe I am using correct syntax???

Name Team
Allanson, Andy Cleveland
Thornton, Andre Cleveland
Butler, Brett Cleveland
Jacoby, Brook Cleveland
Bando, Chris Cleveland
Castillo, Carmen Cleveland
Snyder, Cory Cleveland
Carter, Joe Cleveland
Franco, Julio Cleveland
Hall, Mel Cleveland
Tabler, Pat Cleveland
Bernazard, Tony Cleveland

 


Accepted Solutions
Solution
‎12-13-2017 10:34 AM
Super User
Super User
Posts: 9,402

Re: Label not working in proc print

Add the label option in the proc print (and avoid coding in mixed/upper case):

proc print data=baseball noobs label;
  var name team;
  label team = 'My Team';
run;

View solution in original post


All Replies
Solution
‎12-13-2017 10:34 AM
Super User
Super User
Posts: 9,402

Re: Label not working in proc print

Add the label option in the proc print (and avoid coding in mixed/upper case):

proc print data=baseball noobs label;
  var name team;
  label team = 'My Team';
run;
Super User
Posts: 23,262

Re: Label not working in proc print

You have to add the LABELS option to PROC PRINT so it knows to use labels. 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 171 views
  • 0 likes
  • 3 in conversation