Date: Thu, 20 Sep 2007 16:05:07 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: ? numeric have been converted to character
In-Reply-To: A<1190328959.581749.194170@w3g2000hsg.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
Hi Mindy,
If you think of SAS Macro stuff as
text-substitution then your:
studya=1968519221
and
reverse(&studya)
is going to pass 1968519221 as the
macro variable called studya, and if
you do the text replacement as if the
macro parser will (before sending the
resultant code to the runtime/compiler)
then your
reverse(&studya)
will turn into
reverse(1968519221)
and REVERSE() is expecting a string
argument. Now if you want the 1968519221
to be used as a string then you can add
the doublequotes
reverse("&studya")
which the macro parser will resolve to
reverse("1968519221")
and thus not complain about a number
being passed where a string is expected.
Hope this is helpful.
Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investments
Russell Investments
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Mindy
Sent: Thursday, September 20, 2007 3:56 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: ? numeric have been converted to character
Hey guys,
Below is sample code I am running. And I have a question here:
In the log there is a note
NOTE: Numeric values have been converted to character values at the
places given by: (Line):(Column). 1:1 _ I don't understand where it
comes from because I have used put function and also I have defined
temp as character variable.
sample code
options mlogic mprint symbolgen;
%macro try(studya=, studydir=);
data _null_;
length temp $6;
temp=substr(reverse(&studya), 1, 6);
temp=reverse(temp);
call symput('temp1',put(temp, 6.));
run;
%if &studydir=test %then %let libname=t&temp1;
%mend;
%try (studya=1968519221, studydir=test)
run;
Thanks,
Mindy