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 :
The ouput iam expecting like below --wide
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"?
PDF and just 2 columns but output i want to print wide instead of narrow..
options orientation=landscape;
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.
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;
Try PDF destination option column= . ods pdf columns=4; proc print data=sashelp.air noobs;run; ods pdf close;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.