BookmarkSubscribeRSS Feed
mmkr
Obsidian | Level 7

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

 

 

7 REPLIES 7
mmkr
Obsidian | Level 7

The ouput iam expecting like below --wide

 

image.png

ballardw
Super User

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"?

mmkr
Obsidian | Level 7

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

Reeza
Super User
options orientation=landscape;
Reeza
Super User

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.

Shmuel
Garnet | Level 18

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;





Ksharp
Super User
Try PDF destination option column= .



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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 1414 views
  • 2 likes
  • 5 in conversation