MailLib Concept - Exercise #6

Data

data lb;
    length lbtest $40;
    lbtest='Hematocrit';                        output;
    lbtest='Leukocytes';                        output;
    lbtest='HDL Cholesterol/Total Cholesterol'output;
run; 

Program

proc format;
    value $lbtest   'Hematocrit'     ='HCT'
                    'Leukocytes'     ='WBC'
                    'HDL Cholesterol'='HDL';
    value $lbtestcd 'HCT'='Hematocrit'
                    'WBC'='Leukocytes'
                    'HDL'='HDL Cholesterol';
run;
 
data lb_new;
    set lb;
    length lbtestcd $40;
    lbtestcd=put(lbtest,$lbtest.);
run; 

The variable lbtestcd is created using the variable lbtest and the format $lbtest. The goal is to get the short name of the laboratory test from the long one.

a) Task

Display the width and the default width of the format label $lbtest.

b) Question

Why "HDL Cholesterol/Total Cholesterol" becomes "HDL"?

c) Task

Update the program in order to display the full test name in the variable lbtestcd when no match is available in the format.

Before After

d) Task

Update the program in order to display the text "To Check" when no match is available in the format.

Before After

SOLUTION TOMORROW

Copyright © 2024 xxformat GmbH, All Rights Reserved

xxformat GmbH

c/o STARTPLATZ, Im Mediapark 5
50670 Cologne
Germany

Amtsgericht Köln HRB 90276

Geschäftsführer: Véronique Bourcier
veronique.bourcier@xxformat.com
+49 1577 288 6066