Date: Tue, 31 Oct 2006 20:09:12 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Help with SUBSTR(left of =) function
In-Reply-To: <1162324878.658775.299370@m7g2000cwm.googlegroups.com>
Content-Type: text/plain; format=flowed
SAS-User ,
I think you will find you will get more productive help if you would do the
following:
1.) Explain what it is you want, not what you are doing currently that isnt
working
2.) Give use some dummy data that is representative of your real data set
3.) Show us the end output you desire.
I have watched this discussion and have a sneaking idea that you are trying
to do something in a less than optimal manner (ie the way your doing it is
just flat out a bad way to do what ever it is you want to accomplish).
Toby Dunn
The obscure we see eventually. The completely obvious, it seems, takes
longer. ~Edward R. Murrow
Think like a man of action, act like a man of thought. ~Henri Louis Bergson
Alice came to a fork in the road. "Which road do I take?" she asked.
"Where do you want to go?" responded the Cheshire cat.
"I don't know," Alice answered.
"Then," said the cat, "it doesn't matter."
~Lewis Carroll, Alice in Wonderland
From: SAS-USER <sathevaibhav@GMAIL.COM>
Reply-To: SAS-USER <sathevaibhav@GMAIL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Help with SUBSTR(left of =) function
Date: Tue, 31 Oct 2006 12:01:19 -0800
Hi,
Thanks for the reply. I did find out the length with length function
and then assigned that length variable into macro variable and then
when i try to use it like this:-
substr(RfRowTx,((&DrlineSz - &length1)/2) = "&Tit1";
output;
RfRowNb=RfRowNb+1;
To print it in the center. But the problem which i am facing now is if
the first line of the title is big and the second line of title is
small then initial few letters of first title also get displayed in
second title line.
For Eg:-
First title be:- "This report is of various tables"
Second title be:- "Mean values"
Then on display the second title is seen something like "This rMean
values".
So i donot know why is this happening. I even tried to use %put to see
what value does macro Tit1 contain. But thats fine. Only when i try to
disply it in center using the above code its giving this problem.
I would really appreciate any kind of help.
Thanks,
SAS USER.
"data _null_;" wrote:
> Are you trying to do something like this....
> View with fixed font.
>
> 65 %let tit1=This is the text to be centered in RfRowTx;
> 66
> 67 data _null_;
> 68 length RfRowTx rule $200;
> 69 ls = input(getoption('ls'),best.);
> 70 substr(RfRowTx,(ls-length("&Tit1"))/2) = "&Tit1";
> 71 do i = 10 by 10 to 200;
> 72 substr(rule,i,1)=put(i,best.-l);
> 73 end;
> 74 put rule $varying200. ls;
> 75 rule = repeat('1234567890',10);
> 76 put rule $varying200. ls;
> 77 put RfrowTx $varying100. ls;
> 78 run;
>
> 1 2 3 4 5 6 7
8
>
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
> This is the text to be centered in RfRowTx
>
>
> I don't know that I would actually do this, you can decide if this is
helpful.
>
> On 10/31/06, SAS-USER <sathevaibhav@gmail.com> wrote:
> > Hi All,
> >
> > I am trying to put titles on top of my report using SUBSTR(left of =)
> > function. Its displaying the titles on the top of each page, but the
> > titles are left aligned. But i want to align them to center. How can i
> > modify the substr statement so that i can have it aligned at the
> > center.
> >
> > The code i am using to put headers is:-
> >
> > substr(RfRowTx,1) = "&Tit1";
> > output;
> > RfRowNb=RfRowNb+1;
> >
> > The first row of code resolves the macro and put what ever characters
> > or text is in that macro variable put it on first line of report. But
> > it puts it as left aligned. And i want that text to be center aligned.
> > Next line outputs it to report. Last line increases the row counter by
> > 1.
> >
> > I would really appriciate if anybody can solve this problem.
> >
> > SAS_USER.
> >