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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 426 views
  • 1 like
  • 3 in conversation