proc freq output fit in one page

Reply
Occasional Contributor
Posts: 16

proc freq output fit in one page

I have just two columns and iam trying to do proc freq and i need ouput to fit in one page , can some one help me out please?

 

Example data : 

image.png

 

 

Occasional Contributor
Posts: 16

Re: proc freq output fit in one page

The ouput iam expecting like below --wide

 

image.png

Super User
Posts: 13,316

Re: proc freq output fit in one page

What output destination are you wanting to use? RTF, PDF or something else?

 

How many levels of a variable to you expect to fit on a "page"?

Occasional Contributor
Posts: 16

Re: proc freq output fit in one page

PDF and just 2 columns but output i want to print wide instead of narrow..

Super User
Posts: 23,275

Re: proc freq output fit in one page

options orientation=landscape;
Super User
Posts: 23,275

Re: proc freq output fit in one page

Yeah, that's not a default output format, unfortunately, so you either need to make it yourself or change it to something that will work. You can try ODS PDF with the landscape option and try adding a few columns but I don't think it will still match your 'table' shown. 

 

But if you have that table then you could PROC PRINT it.

Trusted Advisor
Posts: 1,831

Re: proc freq output fit in one page

If you arestill looking for a solution, addapt next code to your needs.

My first step is to simulate and create a test data:

data test;
  frq = 5;
  do sec=1 to 46;
     output;
     frq+5;
  end;
run;

data tst2;
 set test end=eof;
     retain row 1;
     if mod(_N_/10,1.)=0 then row =10;
     output;
     if row=10 then row=1;
               else row+1;
run;

proc sort data=tst2; by row; run;
proc transpose data=tst2
       out=tst3 prefix=c;
  by row;
  var sec frq;
run;

data tst4;
 set tst3;
  by row;
     retain row col1-col5 val1-val5;
     array cx c1-c5;
     array colx col1-col5;
     array valx val1-val5;
     
     if _NAME_ = 'sec' then 
        do i=1 to 5; colx(i) = cx(i); end;
     else 
        do i=1 to 5; valx(i) = cx(i); end;
     if last.row then output;
     DROP c1-c5 i _name_;
run;
        
proc print data=tst4 noobs label;
 var col1 val1 col2 val2 col3 val3 col4 val4 col5 val5;
 label col1=sec col2=sec col3=sec col4=sec col5=sec
       val1=frq val2=frq val3=frq val4=frq val5=frq;
run;





Super User
Posts: 10,689

Re: proc freq output fit in one page

Try PDF destination option column= .



ods pdf columns=4;
proc print data=sashelp.air noobs;run;
ods pdf close;

Ask a Question
Discussion stats
  • 7 replies
  • 259 views
  • 2 likes
  • 5 in conversation