BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
thewan
Quartz | Level 8

Does anyone know why my ods output file is not being created?

 

This is for a larger macro that I am working on, but I am using a SAS example dataset here. The file can be run as is by changing the destination path under filename.

 

Thank you.

 

 

dm 'log;clear;output;clear; ';
dm 'odsresults; clear';;
PROC DATASETS LIB=work NOlist MEMTYPE=data kill; /*deletes datasets in working directory*/
options nosymbolgen nomprint nomlogic; /*system options set to default*/
proc printto; run; /*ods listing will be redirected inside macro; set this to default again*/

options nonotes symbolgen mprint mlogic;
options missing = "";
filename myfile 'C:\Users\user\Desktop\RA\Mydoc.log'; /*Specify destination for output file*/
proc printto log=myfile new; run;

ods output CrossTabFreqs = Freq_ests;
proc freq data=sashelp.class;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  I think that the crosstabfreqs output object only gets created if you use a TABLES statement for PROC FREQ that generates crosstabs. With no TABLES statement, then PROC FREQ is giving you one way frequencies on every variable in the file -- this is not the crosstabfreqs object, this is the onewayfreq object. Since you do not have TABLES statement that is generating, nothing is getting created.

 

I would at least expect to see this:

tables var1*var2;

if you want crosstabfreqs output object to be created.

 

Hope this helps,

Cynthia

View solution in original post

6 REPLIES 6
Watts
SAS Employee

Looks like your PROC FREQ statement doesn't produce the ODS table (crosstabfreqs) that you're requesting.

Your log probably says something like,

"WARNING: Output 'crosstabfreqs' was not created...."

 

If you specify only a PROC FREQ statement (without a TABLES statement), PROC FREQ produces a one-way frequency table for each variable in the most recently created data set. The doc is here. The ODS name of the one-way frequency table is OneWayFreqs (doc here).  

thewan
Quartz | Level 8

Thank you for quick response.

Do you know why the output table is not being created?

In the code that I'm working on, I have a 'by' statement and a 'tables' statement under proc freq so I need to use crosstabsfreq.

 

Reeza
Super User
CROSSTABSFREQ is the name of the output when you have an interaction term. When you have single variables the name of the output table is ONEWAYFREQS. Use the correct name and you'll get the desired output.
Cynthia_sas
SAS Super FREQ

Hi:

  I think that the crosstabfreqs output object only gets created if you use a TABLES statement for PROC FREQ that generates crosstabs. With no TABLES statement, then PROC FREQ is giving you one way frequencies on every variable in the file -- this is not the crosstabfreqs object, this is the onewayfreq object. Since you do not have TABLES statement that is generating, nothing is getting created.

 

I would at least expect to see this:

tables var1*var2;

if you want crosstabfreqs output object to be created.

 

Hope this helps,

Cynthia

thewan
Quartz | Level 8

Thank you for the input!

 

I was able to figure out where I went wrong with my code.

ballardw
Super User

@thewan wrote:

Thank you for quick response.

Do you know why the output table is not being created?

In the code that I'm working on, I have a 'by' statement and a 'tables' statement under proc freq so I need to use crosstabsfreq.

 


If you want to do a bunch of crosstabs without listing all the combinations you can use syntax like:

 

Proc freq data=have;

   tables (var1 var2 … varn) * (othervar somethingelse andanother);

run;

 

If you want to run a crosstab on ALL pairs of variables

 

Proc freq data=have;

     tables _all_*_all_;

run;

 

I wouldn't recommend that though as any variables with large numbers of unque values such as unique identifiers, prices, measurements like height, weight, temperature or large numbers of variables can create a lot of data.

For a reasonable example of what I mean run that example with _all_ * _all_ on the SASHELP.CLASS data set you should have access to.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 4356 views
  • 4 likes
  • 5 in conversation