Help using Base SAS procedures

Output Data set

Reply
Contributor spg
Contributor
Posts: 61

Output Data set

Hi,

Is it possible to run a series of cross tabulations (say from a survey questionnaire) and save all the outputs in one single table? If I do:

PROC FREQ DATA= WORK. SURVEY;
TABLES Q1*Q51/ NOROW NOPERCENT;
TABLES Q2*Q51/ NOROW NOPERCENT;
TABLES Q3*Q51/ NOROW NOPERCENT/ OUT=WORK.SURVEYOUT;
RUN;

The output table records only the last cross tabulation, in this case Q3*Q51

Thanks.
Super Contributor
Posts: 394

Re: Output Data set

You can use the ODS OUTPUT statement for this:

[pre]
ods output crosstabfreqs=surveyout;
proc freq data=survey;
tables q1*q51 / norow nopercent;
tables q2*q51 / norow nopercent;
tables q3*q51 / norow nopercent;
run;
ods output close;
proc print data=surveyout;
run;
[/pre]
Contributor spg
Contributor
Posts: 61

Re: Output Data set

Thanks Tim!
Ask a Question
Discussion stats
  • 2 replies
  • 129 views
  • 0 likes
  • 2 in conversation