3

Is there a good specific resource to show examples of coding to create the following?

  1. The description of the variable/column within the table, example for TERM_TYPE, would be Disposition at discharge.

  2. The value labels for the variable/column for TERM_TYPE such as 1= Appointment not kept within 14 days of enrollment 2=Client terminates treatment without clinical agreement, 3 = Treatment is complete, etc.

  3. Even if the variable TERM_TYPE is a number, 1, 2, 3, .... it is treated as a categorical/nominal variable.

Thanks for your help in transitioning between statistical coding/programming.

Dagan

flag

2 Answers

3

If I understood you correct, you are wanting to create a data set with properties like these:

  1. A variable called TERM_TYPE that is given a label called "Disposition at discharge" and have the label show up on output
  2. TERM_TYPE should contain numeric values - but should be stored as a character variable
  3. TERM_TYPE should have a custom format so that descriptive text will be seen instead of the underlying coded values.

If this is correct, then here is some code that will do these tasks:

proc format;
    value $termfmt
    '1'='Appt not kept within 14 days of enrollment'
    '2'='Client terminates treatment without clinical agreement'
    '3'='Treatment is complete'
    other='Other';
run;

data testing;
input TERM_TYPE $ PATIENTID;
format TERM_TYPE $termfmt. ;
attrib TERM_TYPE label="Disposition at discharge";
datalines;
1 205668
4 315448
3 466405
2 487987
1 164978
;
options nodate number;
title "Description of work.testing";
proc print data=testing label noobs;
 var PATIENTID TERM_TYPE;
run;
link|flag
0

You could issue a proc contents with an ods pdf statement which will return all the columns in your dataset, their positions, their variable labels, etc. For example:

ods pdf file='C:\Codebook.pdf'; proc contents data=sashelp.class; run; ods pdf close;

To obtain a listing of all the formats in the library library, you could issue something like this:

ods pdf file='C:\Formats.pdf'; proc format library=library fmtlib; run; ods pdf close;

link|flag
I think this question was from someone who doens't even know how to setup the formats or the labels. – jay.l.stevens Nov 4 at 18:44

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.