BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
anupamark
Calcite | Level 5

I am facing the same problem, labels not appearing in proc ,I tried proc options option=label; and option label;

proc options option=label;
run;

option label;
proc format;

   value agegrp 0 - 30 = '0 to 30'

               31 - 50 = '31 to 50'

               51 - 70 = '50 to 70'

               71 - high = '71 and older';

   value $party 'D' = 'Democrat'

                'R' = 'Republican';

   value $likert '1' = 'Strongly Disagree'

                 '2' = 'Disagree'

                 '3' = 'No Opinion'

                 '4' = 'Agree'

                 '5' = 'Strongly Agree';

run;

data Voter;

   input Age Party : $1. (Ques1-Ques4)($1. + 1);

   label Ques1 = 'The president is doing a good job'

         Ques2 = 'Congress is doing a good job'

         Ques3 = 'Taxes are too high'

         Ques4 = 'Government should cut spending';

   format Age agegrp.

          Party $party.

          Ques1-Ques4 $likert.;

datalines;

23 D 1 1 2 2

45 R 5 5 4 1

67 D 2 4 3 3

39 R 4 4 4 4

19 D 2 1 2 1

75 D 3 3 2 3

57 R 4 3 4 4

;


title "Listing of Voter";
proc print data=Voter;
run;


 

 

voter.jpg

Any help/suggestion ,I would be so grateful.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

If you don't actually tell PROC PRINT to use the labels as the column headers it will continue to use the names.  

proc print data=Voter LABEL;

Whether you change the labels to use during PROC by also using LABEL statements or not.

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

PROC PRINT will use the variable names by default.  If you want it to use the labels then add the LABEL option to the PROC PRINT statement.

anupamark
Calcite | Level 5

Thanks for the response ,I tried with label in proc print

 

title "Listing of Voter";
proc print data=Voter;
label   Ques1 = 'The president is doing a good job'

         Ques2 = 'Congress is doing a good job'

         Ques3 = 'Taxes are too high'

         Ques4 = 'Government should cut spending';
       run;

 

Still I get the variable names.

Tom
Super User Tom
Super User

If you don't actually tell PROC PRINT to use the labels as the column headers it will continue to use the names.  

proc print data=Voter LABEL;

Whether you change the labels to use during PROC by also using LABEL statements or not.

anupamark
Calcite | Level 5

thanks ,it worked

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
  • 4 replies
  • 2636 views
  • 1 like
  • 2 in conversation