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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

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