BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have used the 'Label' commmand in a datastep to rename some variable names.

I then want to output this dataset to a PDF file but the PDF retains the old label names.

I have also triend using the 'Label' command in the Proc Print in the ODS code, but again this doesn't seem to work.....


Thanks
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
This code works for me:
[pre]
ods pdf file='xxx.pdf';

proc print data=sashelp.class(obs=3) label;
label name='XXXXX'
age = 'YYYYY'
height = 'ZZZZZ';
run;

ods pdf close;
[/pre]

So does this code, which uses PROC DATASETS to assign new labels to a variable (note that I did not want to relabel variables in SASHELP.CLASS, so I created WORK.NEWCLASS):
[pre]
data newclass;
set sashelp.class;
run;

proc datasets library=work nolist;
modify newclass;
label name='AAAAA'
age = 'BBBBB';
run;
quit;

ods pdf file='aaa.pdf';

proc print data=newclass(obs=3) label;
run;
ods pdf close;
[/pre]

I'm also not sure what you mean by "output this dataset to PDF" -- it seems to mean that you're using ODS PDF and PROC PRINT???? The Label statement and the LABEL option in PROC PRINT should be working. If you try the above code and you do not get labels in your PROC PRINT output, then I suggest you open a track with Tech Support for more in-depth help.

cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 1 reply
  • 1034 views
  • 0 likes
  • 2 in conversation