@kcvaldez98 wrote:
Hi!
I am doing a project for one of my classes and my professor requests that we create a data dictionary using ODS Output. I have no idea what that is and I've tried looking it up.
They want it to Include variable names, labels, type, and length, and to create a PDF file.
Please advise.
You can create data sets of just about any output displayed in the Results. Most of the procedures have an entry in the online help Details or Results tab that lists ODS Table names (i.e. data sets created by the procedure). Some of those entries are pretty long and not very clear. You can use the ODS TRACE command with your procedure to get the details your syntax provides.
If you run:
ods trace on;
proc contents data=sashelp.class ;
run;
ods trace off;
Your log will show something like:
Output Added:
-------------
Name: Attributes
Label: Attributes
Template: Base.Contents.Attributes
Path: Contents.DataSet.Attributes
-------------
Output Added:
-------------
Name: EngineHost
Label: Engine/Host Information
Template: Base.Contents.EngineHost
Path: Contents.DataSet.EngineHost
-------------
Output Added:
-------------
Name: Variables
Label: Variables
Template: Base.Contents.Variables
Path: Contents.DataSet.Variables
-------------
These bits generally appear in the order of the results output. So you want the VARIABLES table.
ods output variables=myvariabledataset;
proc contents data=sashelp.class ;
run;
Will send the details of the variables table to the data set myvariabledataset. (Pick a name you like).
Then use ODS PDF and proc print to create the document.
ods pdf file="path\datadictionary.pdf";
proc print data=myvariabledataset noobs;
run;
ods pdf close;
Note that if no variables in the data set have any labels then Proc Contents doesn't display a label column. If at least one variable has an assigned label it will appear.