IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

PROC PRINT in SAS


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mambopras

New User


Joined: 11 Nov 2008
Posts: 52
Location: Hyderabad

PostPosted: Fri May 27, 2011 1:04 am
Reply with quote

i want to use a PROC PRINT in SAS but not center the TITLES, I want to just center the data. Is this possible ? If so, can you please let me know how ???
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1744
Location: Tirupur, India

PostPosted: Fri May 27, 2011 12:21 pm
Reply with quote

Hello,

You could try the below code for your requirement,
Code:
option nodate nonumber;                                               
title 'Superstar Rajni Vaalga';            *<--- Your title statement;
                                                                       
proc sql noprint;                                                     
  select setting length=3 into :ls_len                                 
    from dictionary.options                                           
    where optname='LINESIZE';                                         
  select count(*), text length=&ls_len into :count,                   
                 :ttl_1-:ttl_10 notrim                                 
    from dictionary.titles                                             
    where type='T'                                                     
    order by number;                                                   
quit;                                                                 
                                                                       
%macro tls_;                                                           
  %do i = 1 %to &count;                                               
    title&i. "&&ttl_&i";                                               
  %end;                                                               
%mend;                                                                 
                                                                       
%tls_;                                                                 
                                                                       
proc print data=sashelp.class;                  *Your proc print step;
run;                                                                       


Output:
Code:
Superstar Rajni Vaalga                                       
                                                             
              Obs    Name       Sex    Age    Height    Weight
                                                             
                1    Alfred      M      14     69.0      112.5
                2    Alice       F      13     56.5       84.0
                3    Barbara     F      13     65.3       98.0
                4    Carol       F      14     62.8      102.5
                5    Henry       M      14     63.5      102.5
                6    James       M      12     57.3       83.0


Hope it helps.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1744
Location: Tirupur, India

PostPosted: Fri May 27, 2011 12:25 pm
Reply with quote

I dont know why the below code does not work for me, you could try this on your SAS installation.

Code:
title1 'some title' justify=left;   
proc print data =sashelp.class;
run;     
Back to top
View user's profile Send private message
mambopras

New User


Joined: 11 Nov 2008
Posts: 52
Location: Hyderabad

PostPosted: Sat May 28, 2011 12:16 am
Reply with quote

I will have to try the code, thanks for the help
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Sat May 28, 2011 1:13 am
Reply with quote

Although I haven't had a chance to try this yet, the manual at SAS Support says it works:
Code:
TITLE1 JUSTIFY=LEFT 'TITLE TEXT';
and the JUSTIFY must precede the text.
Back to top
View user's profile Send private message
mambopras

New User


Joined: 11 Nov 2008
Posts: 52
Location: Hyderabad

PostPosted: Sat May 28, 2011 3:57 pm
Reply with quote

I tried that and I couldn't succeed, but it is my mistake that I haven't explained the intricacy in the requirement and was expecting an answer. I want a part of my title to be centered and a part left justified (both of them should be on the same line).... I am trying with JUSTIFY statements..but no luck yet.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat May 28, 2011 4:17 pm
Reply with quote

So, you have a user who wants exactly the output he wants from a product whose standard output probably satisfies most users.

You end up spending 50% of the effort in getting the report looking how he/she wants.

Can you make your title into one long literal of 132 characters and just exactly spaced how he/she wants it? It will "look" like part of it is left-justified and part centred.

I used a different product where we had the same problem. An un-moving user who wanted the report to look like all the other reports he'd ever seen, but which would have almost meant no point in using the reporting product purchased to give him the new reports he wanted quickly.

However, the product allowed us to write an "exit" program for the report output, so in the "exit" (a Cobol program) we could do his exact heading/footer style and from the reporting tool use all the quick-and-easy features of the report. I have no idea if this is an option for SAS.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sat May 28, 2011 4:27 pm
Reply with quote

Try PROC REPORT.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1744
Location: Tirupur, India

PostPosted: Sat May 28, 2011 4:48 pm
Reply with quote

Quote:
I tried that and I couldn't succeed, but it is my mistake that I haven't explained the intricacy in the requirement and was expecting an answer. I want a part of my title to be centered and a part left justified (both of them should be on the same line).... I am trying with JUSTIFY statements..but no luck yet.


You could have shown us a sample of the output required in the first place..

Quote:
try proc report

I guess proc report allows customizations of individual columns and formatting flexibility, as far as customizing title statements, proc report and proc print have no difference.(im willling to be corrected here)
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Sat May 28, 2011 5:31 pm
Reply with quote

What you want to do can be done by using NOTITLES on the FILE statement and then put data in the exact columns you want on each line. Of course, this means you are NOT using a PROC to print, but writing your own code to output every byte on every line of the page. The effort is much, much higher than using PROC PRINT or PROC REPORT, but on the other hand it allows you to achieve results that those procedures won't support.
Back to top
View user's profile Send private message
mambopras

New User


Joined: 11 Nov 2008
Posts: 52
Location: Hyderabad

PostPosted: Sun May 29, 2011 1:07 pm
Reply with quote

Robert,
we ended up doing the same, it increased the coding effort a lot as you said - But that had its own problems too as we had to handle each column separately. I was just not comfortable with the effort we were putting in, so tried reading manuals and searching over the net if we have any option in PRO PRINT itself. However we have taken the long route!!!

Peter, I have to read about PROC REPORT, may be I will try it.

Thanks to all of you for your suggestions and ideas..
Back to top
View user's profile Send private message
mambopras

New User


Joined: 11 Nov 2008
Posts: 52
Location: Hyderabad

PostPosted: Sun May 29, 2011 1:12 pm
Reply with quote

But just as an after thought, I still dont believe that we do not have a better or efficient way of handling the title stuff as we want - SAS being such a powerful tool . . .It would be nice if any discoveries in the future about this be shared. ( I would share mine too if I come across any ).
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Sun May 29, 2011 1:39 pm
Reply with quote

why not check also
support.sas.com/forums/index.jspa?categoryID=1
where You might get answers also from the SAS people themselves ?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1744
Location: Tirupur, India

PostPosted: Sun May 29, 2011 1:39 pm
Reply with quote

I have done such a thing once, that's the reason I asked for a sample output of what is required.
Back to top
View user's profile Send private message
mambopras

New User


Joined: 11 Nov 2008
Posts: 52
Location: Hyderabad

PostPosted: Sun May 29, 2011 2:21 pm
Reply with quote

Vasanth,
I got your point - But there are copy - paste issues on my work pc - basically clipboard problems. Will try FTPing it.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Sun May 29, 2011 2:26 pm
Reply with quote

the best way ( in my experience at least ) to copy and past from the 3270 emulator

is to use a PC editor with a fixed font, copy and paste, fix the small details
and cut and paste from there to the forum post

easier also to check for tupogryplical errors
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Mon May 30, 2011 1:23 am
Reply with quote

Or simply copy from the 3270 emulator screen and paste into the Reply Editor here. Then highlight and click the "Code" tag.

We have a Preview function so you can see your post as it will appear to the forum (rather than how it appears in this editor). Once the post appears as you want, click Submit.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Starting a PROC with parameters from ... CLIST & REXX 6
No new posts Reroute print output via REXX/SDSF TSO/ISPF 6
No new posts JCL sortcard to print only the records DFSORT/ICETOOL 11
No new posts is there a way to print time in HH:MM... SYNCSORT 12
No new posts Print out all lines with 'IBM' compil... CLIST & REXX 8
Search our Forums:

Back to Top