SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Code book

Reply
New Contributor
Posts: 2

Code book

Hi everyone.

 

Please assist me in creating a code book.

I have typed out the label and formats.

I need a pdf or word document showing what all the categorical variable values stand for.

I am trying to follow steps on the internet but not winning.

 

This is what I tried to do:

 

libname long "P:\RICE Project\Check\MergeProject";
libname library 'P:\RICE Project\Check\Do files\labels';
run;
title1 RICE study codebook;

%let organization=(ID);
%macro proc codebook(lib=ProjectLong,file1=label_book,fmtlib=work,pdffile= "P:\RICE Project\Check\Do files\labels\ricecb.pdf");
ods listing close;

 

I actually don't understand what I need to write for %let organization??

 

Will appreciate your help.

 

 

 

 

Super User
Super User
Posts: 9,427

Re: Code book

I do not know what a code book is.  If you want to print the formats list then use the cntlout option in proc format to create a dataset, then proc report that dataset.  There is plenty wrong in the code you present:

libname long "P:\RICE Project\Check\MergeProject";
libname library 'P:\RICE Project\Check\Do files\labels';
run; <- not needed
title1 RICE study codebook; <- titles should be in quotes

%let organization=(ID);  <- this sets organisation macro variable to the string "(ID)"
%macro proc codebook(lib=ProjectLong,file1=label_book,fmtlib=work,pdffile= "P:\RICE Project\Check\Do files\labels\ricecb.pdf");

<- in the above you cannot have the word proc, is this a macro definition as I see no code underneath it?
ods listing close;  <- what is this for?

Trusted Advisor
Posts: 1,831

Re: Code book

Please post what do have, what kind of file is it?

and describe what do you want to achieve, what kind of output - 

is it a sas dataset? an external file or a print listing?

New Contributor
Posts: 2

Re: Code book

Hi all thanks for your responses.

 

I have attached the document where I got the code.

There is also an example of a code book.

Super User
Super User
Posts: 9,427

Re: Code book

Yes, that paper is 8 years old.  I would suggest you look at an industry standard - CDISC - in particular define documents, but maybe in this case one of the earlier in the chain models.

PROC Star
Posts: 1,288

Re: Code book

Here's a rejigged program based on your example and on the document that you provided, that might work. I'm not sure if the pdffile parameter is okay, you might have to change it to pdffile=ricecb.pdf and see where the macro puts the file.

 

The organization macro variable is supposed to indicate the file organization, in their example it is "One Record per Participant (ID)".

 

Tom

 

libname long "P:\RICE Project\Check\MergeProject";
libname library 'P:\RICE Project\Check\Do files\labels';
run;
title1 RICE study codebook;

%let organization=(ID);
%proc_codebook(lib=long,file1=label_book,fmtlib=work.formats,pdffile="P:\RICE Project\Check\Do files\labels\ricecb.pdf");
run;
ods listing close;

PROC Star
Posts: 1,288

Re: Code book

The code that you are posting isn't functional. Where did you get it? If we have a look at the original document, we might be able to provide some useful information.

 

Tom

Super User
Posts: 13,332

Re: Code book

Provide either the code for the macro or what you need in your code book.

Ask a Question
Discussion stats
  • 7 replies
  • 197 views
  • 0 likes
  • 5 in conversation