Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAS: How to output only the part of PROC CONTENTS that displays the variables in the data set?

Tags:

sas

I'm in a beginner SAS class and we are required to display only the section of the PROC CONTENTS output that shows the variables in the dataset. For example, when you do

proc contents data=whas.heart3;
run;

The output is 3 tables. The 3rd table is titled:

Alphabetic List of Variables and Attributes

I need to figure out how to modify the above code to display only that 3rd table.

like image 596
jstewartmitchel Avatar asked Sep 18 '13 03:09

jstewartmitchel


People also ask

What does Varnum do in Proc contents?

VARNUM. prints a list of the variable names in the order of their logical position in the table. The physical position of the variable in the table is engine-dependent.

Which proc print option displays variable labels in the report?

If a variable does not have a label, PROC PRINT uses the variable's name as the column heading. Interaction: By default, if you specify LABEL and at least one variable has a label, PROC PRINT prints all column headings horizontally. Therefore, using LABEL may increase the number of pages of output.

Can you use where in Proc print?

The where statement allows us to run procedures on a subset of records. For example, instead of printing all records in the file, the following program prints only cars where the value for rep78 is 3 or greater. PROC PRINT DATA=auto; WHERE rep78 >= 3; VAR make rep78; RUN; Here is the output from the proc print.

How do you output a proc tabulate to a dataset?

THE EASY WAY: USE THE OUT= OPTION OR AN ODS OUTPUT STATEMENT The OUT= option in the PROC TABULATE statement makes it easy to create an output dataset.


1 Answers

Out put is delivered via the Output Delivery System (ODS). Use ods trace on; and the system will tell you what is being delivered. In this case, Variables is the table you are looking for.

Use ods select Variables; to tell ODS to ONLY deliver the variables table. Then reset to default (ods select default;) for other procedures.

ods select Variables;
proc contents data=mydata;
run;
ods select default;
like image 141
DomPazz Avatar answered Nov 16 '22 02:11

DomPazz