View previous topic :: View next topic
|
Author |
Message |
mambopras
New User
Joined: 11 Nov 2008 Posts: 52 Location: Hyderabad
|
|
|
|
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 |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
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 |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
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 |
|
|
mambopras
New User
Joined: 11 Nov 2008 Posts: 52 Location: Hyderabad
|
|
|
|
I will have to try the code, thanks for the help |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
mambopras
New User
Joined: 11 Nov 2008 Posts: 52 Location: Hyderabad
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Try PROC REPORT. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
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..
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
mambopras
New User
Joined: 11 Nov 2008 Posts: 52 Location: Hyderabad
|
|
|
|
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 |
|
|
mambopras
New User
Joined: 11 Nov 2008 Posts: 52 Location: Hyderabad
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
I have done such a thing once, that's the reason I asked for a sample output of what is required. |
|
Back to top |
|
|
mambopras
New User
Joined: 11 Nov 2008 Posts: 52 Location: Hyderabad
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|