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.
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:
I hope this is helpful!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.