ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 32

The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a permanent label of "Asking Price".
Which one of the following SAS programs temporarily replaces the label "Asking Price" with the label "Sale Price" in the output?
A. proc print data = sasuser.houses;
label price = "Sale Price";
run;
B. proc print data = sasuser.houses label;
label price "Sale Price";
run;
C. proc print data = sasuser.houses label;
label price = "Sale Price";
run;
D. proc print data = sasuser.houses label = "Sale Price";
run;
Click Comment link to get answer

27 comments:

  1. Anonymous10:19 AM

    A
    if C, you can not change the label. Because you have already define label in the proc print.

    ReplyDelete
    Replies
    1. Permanent Labels can only be defined in Data Step, Proc step can only be used to define temp labels... and to get the o/p from Label statement in Proc Step we need to use label option.

      Delete
    2. at the beginning of the proc step,it is short for a label option.

      Delete
  2. if you are using label statment inside proc print then you need to use label option on your proc print statement. This label inside a proc is applied temporarily and will replace any permanent labels. Hence answer is C.

    ReplyDelete
  3. Anonymous9:22 AM

    Answer is C

    ReplyDelete
  4. Anonymous12:14 PM

    Yes Answer C is Perfect

    ReplyDelete
  5. Anonymous4:17 PM

    Answer is A

    The question is changing label temporarily,not permanently.

    ReplyDelete
  6. Rajiv1:01 PM

    Answer is C. Option A wont reflect the change in the output, so there wont be any change neither temporary nor permanent on the label.

    ReplyDelete
  7. I think it is 'c'. Can anyone tell the correct answer for this.

    ReplyDelete
  8. Anonymous10:09 PM

    C 100%
    bcoz if you want to assagin temporary lable.
    we need to assign like ;;d;;

    ReplyDelete
  9. Anonymous11:16 PM

    The correct answer is C 100%
    This is the program that I had run:
    data sashelp.birthday;
    input empid birthdat date7.
    lastname: $18.
    firstnam: $15.
    phone: $4.;
    datalines;
    459287 05JAN84 RODRIGUES JUAN 5879
    127845 25DEC85 MEDER VLADIMIR 6231
    254896 06APR80 TAYLOR-HUNYADI ITO 0231
    ;
    proc print data=shilpa.birthday label;
    format birthdat date7.;
    label empid="employee_id";
    label phone="phone_number";
    label birthdat="DOB";
    run;

    After running this program I got the correct output as "empid" was changed to "employee_id" & the same result was obtained for the others. But if we remove the label option from proc print statement & just keep the label statement. It doesnt change the label so I think using label option in proc print statement alongwith label statement are necessary to produce the required output.

    ReplyDelete
  10. Anonymous8:49 AM

    it's C... I tried it

    ReplyDelete
  11. Anonymous10:38 PM

    At first I thought B and C are the same but looking closely -- B does not have an equal operator after price and so C is the correct code.

    ReplyDelete
  12. Anonymous9:08 PM

    data test;
    v1 = 110700;
    run;

    proc print data=test label;
    title 'Base SAS 32';
    format v1 dollar11.2;
    label v1 = 'test';
    run;

    Answer is C

    ReplyDelete
  13. Anonymous6:52 PM

    In the PRINT PROCEDURE," Default: If you omit LABEL OPTION, PROC PRINT uses the variable's name as the column heading even if the PROC PRINT step contains a LABEL statement. If a variable does not have a label, PROC PRINT uses the variable's name as the column heading." So the answer is C.

    ReplyDelete
  14. Anonymous2:02 PM

    The correct answer is C. Some of you said A and fot those of you who said that the correct answer is A, read the SAS help and syntax for proc print. If you want do display label in proc print, you have to secify label in the proc print statement and a label statement inside the proc print.

    ReplyDelete
  15. The second line of code is incorrect in every answer choice. It should be listed as:
    label Asking Price = 'Sale Price';

    ReplyDelete