BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
kcvaldez98
Obsidian | Level 7

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.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@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.

 

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Creating a data dictionary is independent of ODS OUTPUT, it could be done without ODS OUTPUT.

 

ODS OUTPUT can be used to create a data dictionary, but it isn't required in general (perhaps it is required for this project).

 

But we need a lot more background on the entire project. Data dictionary of what? What type of file is this data dictionary supposed to be stored in? Explain the whole thing.

--
Paige Miller
ballardw
Super User

@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.

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 847 views
  • 0 likes
  • 3 in conversation