Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

proc frequency output

Status
Not open for further replies.

janelange

Technical User
Jun 12, 2003
45
US
Hi,

I have a huge dataset with about 1300 variables. I'd like to create a table that lists the information generated in a proc frequency statement for each of the variables in the dataset.

I know it's possible to generate output tables for individual variables, but what about one for all the variables combined?

I looked up info on the ODS commands and tried this code:
Code:
 proc freq data=baseline;
ODS OUTPUT Table=baseline_freq;
run;

However, I got the following error message:
WARNING: Output 'Table' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used.

Thoughts?
Jane L.
 
Hi Jane,
The problem here is the ODS Output statement. First I would say it shouldn't be in the proc freq statement, it should be before it.
Next, "Table" refers to the object type that you are writing to the dataset "baseline_freq". I'm guessing that Proc Freq doesn't create an object type "Table".
This gives details:-
Specifically:-

If you use ODS TRACE ON first like this:-
(note, I'm using sashelp.class as this will work on your install as well, it's part of the basic install)
Code:
ods trace on;
proc freq data=sashelp.class;
run;
ods trace off;
you'll get the following in your log:-
Code:
Output Added:
-------------
Name:       OneWayFreqs
Label:      One-Way Frequencies
Template:   Base.Freq.OneWayFreqs
Path:       Freq.Table1.OneWayFreqs
-------------
repeated for each variable (might be worth doing it on ONE variable to start with).
This tells you that you need to use the name "OneWayFreqs" instead of "Table" which is the object type created by a Proc Tabulate. This is very poorly explained there in the doco.
Your code should end up like this:-
Code:
ods output OneWayFreqs=mydset;
proc freq data=sashelp.class;
run;
ods output close;
I hope this helps. The Second URL posted there is accessed by clicking on the note icon to the left of the line of "ods output" line of code in the example shown on the first URL.
 
As a follow up, I would suggest that a dataset with 1300 variables is a little excessive to say the least, feeding that data into the code above could give you a huge dataset if there are lots of possible values in each column.
Runt he code I posted onthe sashelp.class table and browse the results dataset, you'll find it's made the dataset quite a bit larger than it was to start with. You could well end up with results that are harder to work with than the original data.
I would STRONGLY recommend that you re-examine exactly what you are trying to achieve with this program.
 
Thanks a lot for your help.

When I run the code example that you gave me and open up the output table, it looks something like this:

Table Name Name Freq etc....
Name Alice Alice 1
Name Bob Bob 1
Sex . . 5
Sex . . 9
Age . . 2
Age . . 3
Age . . 1

Ultimately, I would like to see the values of the sex and age variables for which I'm calculating the frequencies.

I know this 1300 variables is unwieldy; I'm trying to get a handle on which of these variables have certain responses, and having a searchable sortable table will make this task much easier.

Jane




 
Cool. I guess I've never been in a situation where I've really even had the chance to build a table that big, I tend to work with much smaller domains of data (financial, personal, demographic etc) which are generally pretty concise.
Good luck, and welcome to the SAS forum. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top