Hello,
I can't seem to get the labels to show up in my proc print. Here is my code and the output I'm receiving.
DATA
You need to specify the LABEL option in the PRINT statement.
proc print data=hypanl.test LABEL;
@ksumbundu wrote:
Hello,
I can't seem to get the labels to show up in my proc print. Here is my code and the output I'm receiving.
title1 "Subjects Who Died from Heart Failure";proc print data=hypanl.test;var wtlb sbp bmi;labelSSN = 'Soc Sec Number'WtLb = 'Subject Weight'SBP = 'Systolic Blood Pressure';ID SSN;run;
DATA
data WORK.TEST;infile datalines dsd truncover;input SSN:$11. GenderCd:32. EthCd:$16. RaceCd:$16. EthRaceCd:$3. BirthDt:32. StateCd:$2. VisitDt:32. HtIn:32. WtLb:32. SBP:32. DBP:32. DeathDt:32. ICD10:$6. CODCd:32. HypRelDeathInd:32. BMI:32.;label SSN="Social Security Number" GenderCd="Gender Code" EthCd="Ethnicity Code" RaceCd="Race Code" EthRaceCd="Ethnicity/Race Code" BirthDt="Birth Date" StateCd="StateCd" VisitDt="Visit Date" HtIn="Height (In)" WtLb="Weight (Lb)" SBP="Systolic BP (mmHg)" DBP="Diastolic BP (mmHg)" DeathDt="Death Date" ICD10="ICD 10 Code" CODCd="Cause of Death Code" HypRelDeathInd="Hypertension-Related Death";datalines;147-48-1068 1 H W HIS 2306 UT 19848 65 158 123 61 . . 0 26.925443787184-44-2710 1 H W HIS 11974 IA 20012 69.738 174.195 128 74 . . 0 25.788685458416-08-7584 1 H B HIS 8418 MS 19740 72 176 106 77 . . 0 24.444444444417-75-1425 1 H W HIS 7205 MS 19983 73 188 106 65 . . 0 25.400638018417-98-4516 1 H B HIS 1924 MS 19827 67 196 127 74 . . 0 31.436845623;;;;
You need to specify the LABEL option in the PRINT statement.
proc print data=hypanl.test LABEL;
@ksumbundu wrote:
Hello,
I can't seem to get the labels to show up in my proc print. Here is my code and the output I'm receiving.
title1 "Subjects Who Died from Heart Failure";proc print data=hypanl.test;var wtlb sbp bmi;labelSSN = 'Soc Sec Number'WtLb = 'Subject Weight'SBP = 'Systolic Blood Pressure';ID SSN;run;
DATA
data WORK.TEST;infile datalines dsd truncover;input SSN:$11. GenderCd:32. EthCd:$16. RaceCd:$16. EthRaceCd:$3. BirthDt:32. StateCd:$2. VisitDt:32. HtIn:32. WtLb:32. SBP:32. DBP:32. DeathDt:32. ICD10:$6. CODCd:32. HypRelDeathInd:32. BMI:32.;label SSN="Social Security Number" GenderCd="Gender Code" EthCd="Ethnicity Code" RaceCd="Race Code" EthRaceCd="Ethnicity/Race Code" BirthDt="Birth Date" StateCd="StateCd" VisitDt="Visit Date" HtIn="Height (In)" WtLb="Weight (Lb)" SBP="Systolic BP (mmHg)" DBP="Diastolic BP (mmHg)" DeathDt="Death Date" ICD10="ICD 10 Code" CODCd="Cause of Death Code" HypRelDeathInd="Hypertension-Related Death";datalines;147-48-1068 1 H W HIS 2306 UT 19848 65 158 123 61 . . 0 26.925443787184-44-2710 1 H W HIS 11974 IA 20012 69.738 174.195 128 74 . . 0 25.788685458416-08-7584 1 H B HIS 8418 MS 19740 72 176 106 77 . . 0 24.444444444417-75-1425 1 H W HIS 7205 MS 19983 73 188 106 65 . . 0 25.400638018417-98-4516 1 H B HIS 1924 MS 19827 67 196 127 74 . . 0 31.436845623;;;;
Hello,
Try putting the label on your Proc Print statement. You can also try using this method using the code below.
I hope this helps!
PROC PRINT DATA=dataname
SPLIT= "*";
WHERE CODCd =2;
ID SSN;
VAR WtLb BMI SBP;
LABEL SSN = 'Soc Sec*Number'
WtLb = 'Subject Weight'
BMI = 'Body Mass Index'
SBP = 'Systolic Blood Pressure';
RUN;
Hello!
Use a label statement to specify the column headers. You want to include a SPLIT = '*' statement to tell SAS where to split, and the split is where the * is. Then make sure to include * in your label statements where you want the label to move to a new line.
Hello,
I had the similar issue at the beginning and I fixed it with the following code. I used NOOBS instead of ID statement but I am pretty sure it should do the same thing.
I added SPLIT statement to make sure that look the same as the homework requirements.
Valerie
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.