Date: Tue, 14 Feb 2006 02:30:57 +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: Substr from macro value
In-Reply-To: <1139878163.727927.33360@z14g2000cwz.googlegroups.com>
Content-Type: text/plain; format=flowed
Phil,
Harry is correct in that %scan was built for this. Also you dont need to
create another macro variable. Consider the following:
%Let Table1 = Mocca.Sep05 ;
Title2 "Reference period = %scan(&Table1,2,.)" ;
I think you will find this way more stable, easier to code, maintain, and
read.
Toby Dunn
From: phillip.anderra@GMAIL.COM
Reply-To: phillip.anderra@GMAIL.COM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Substr from macro value
Date: Mon, 13 Feb 2006 16:49:23 -0800
Hi group,
This is probably embarrassingly elementary but I can't get a result.
Am trying to get a string from a simple macro value into a Title
statement eg
%Let Table1 = Mocca.Sep05;
The month value varies so I want to take the five right side characters
into another macro to use in a Title statement. eg
%Let mnth = substr(&Table1,7,5);
Title2 "Reference period = &mnth.";
However everything I've tried crashes on the period in the Table1 macro
value, the log saying; "...Variable names of the form X.X must be
either FIRST.X or LAST.X."
Can someone please help an incompetent out on this?
Phil