BookmarkSubscribeRSS Feed
James18
Obsidian | Level 7

Hi everyone,

 

I am trying to use a PROC PRINT step to display only the subjects who died from a stroke from my data set. I am already satisfied with almost every part of the data set, but I would like to remove a line above my table where it says "Cause of Death Code = Stroke" just below my Title.

This is the code I have been working with:

PROC SORT
DATA = Hypdt.Stroke
OUT = WORK.hypdta_ST;
BY DESCENDING CODCd SSN ;
RUN;


TITLE1 "Subjects Who Died from #BYVAL(CODCd)";
PROC PRINT data= WORK.hypdta_ST
SPLIT = '*'
NOOBS ;
By DESCENDING CODCd;
PAGEBY CODCd;
ID SSN;
VAR WtLb BMI SBP;
LABEL SSN = '* Soc Sec * Number'
WtLb = '* Subject * Weight'
BMI = 'Body * Mass * Index'
SBP = 'Systolic * Blood * Pressure';
RUN;

The result I am getting is displayed below. I am not concerned with the values displayed inside the table. I am simply trying to remove the line below the title. Any guidance would be greatly appreciated.

 
 
 

sherricj18_1-1607906379779.png

 

 

 

2 REPLIES 2
mvhoya
Obsidian | Level 7

I believe you are seeing the "Cause of Death Code = Heart Failure" line under your title because of a few things. First you're using a BYVAL option in your title which is used to customize titles to values of the BY variable. Additionally you're using a BY statement and a PAGEBY statement. The PAGEBY statement is needed for the #BYVAL option to display a different title on each page of a report. Try changing your title1 to "Subjects Who Died from Heart Failure" and removing the BY and PAGEBY statements. Instead, use a WHERE statement to display the five subjects who died from heart failure.

 

I suggest trying the following code: Screen Shot 2020-11-30 at 11.05.13 PM.png

 

 

 

 

 

 

 

 

I hope this is helpful! 

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
  • 2 replies
  • 3234 views
  • 0 likes
  • 3 in conversation