BookmarkSubscribeRSS Feed
mysasusername
Calcite | Level 5

This is my current code which prints the tables I need and the output I need. However, I have 2 issues: 

First, my labels just aren't showing up in anything. I cannot put them in the print step as my prompt calls for having the labels in the data step. I've tried moving them around and they just aren't sticking.

Second, I need to make it so rather than using a where statement (which I know is very inefficient I just wanted a placeholder to get my table) in my MIschools print and a where statement in my blowouts print, I need to do those in my data step. I cannot get my data step to give me proper output when I try doing these processes in the data step. 

Here is my current code:

 

data rosebowl
(keep= year winteam winpts loseteam losepts mov)
MIschools
(keep= year winteam winpts loseteam losepts mov)
blowouts
(keep=year winteam mov);
set rose_raw;
Year = year(date);
MOV = WinPts-LosePts;
label WinPts='Winning Score'
LosePts='Losing Score'
WinTeam='Winning Team'
LoseTeam='Losing Team'
MOV='Margin of Victory';
run;

proc print data=rosebowl;
run;

proc print data=MIschools;
where winteam="Michigan" or loseteam="Michigan"
or winteam="Michigan State" or loseteam="Michigan State";
run;

proc print data=blowouts;
where MOV >= 21;
run;

2 REPLIES 2
Reeza
Super User
You need to add the LABELS option to your PROC PRINT statement to have the labels show. I'll also usually add NOOBS to suppress the row numbers.

proc print data=blowouts labels noobs;

I don't understand your second question, it would help if you showed your data as well as your code - fake data is perfectly fine.
Ideally you show what you have and what you want as the output.
ballardw
Super User

You have to tell Proc print to use the label on the Proc statement

 

proc print data=MIschools label;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 446 views
  • 1 like
  • 3 in conversation