Date: Mon, 21 Feb 2000 10:32:36 +0100
Reply-To: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Subject: Re: macro variable more-than-8-char-problem
Content-Type: text/plain; charset="iso-8859-1"
Torben,
I assume your intercept is not a variable name in a dataset. If it would be
and you would use SAS vs. 8 (which I don't have) than I would not expect
that error, for AFAIK variable names longer than 8 characters are allowed in
vs. 8.
So I expect it to be ( and intended as such) just a text. In macro
statements text needs not to be qouted (macro language is only
textprocessing). However in a normal data step such text should be qouted
and thus your statement
if &intercpt = intercept then pp=p+1; * this would compare
variables;
should read:
if "&intercpt" = "intercept" then pp=p+1; * this compares values;
It is necessary to use the double quote, because otherwise the macro
variable &intercpt would not be resolved.
I hope this is clear.
Regards - Jim.
--
Y. Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statistician, P.O. Box 1 fax. +31 412 407 080
head IT department 5350 AA BERGHEM IMRO TRAMARKO: a CRO
J.Groeneveld@ITGroups.com the Netherlands in clinical research
My computer now is used long enough to the year ²°°° trap.
> -----Original Message-----
> From: Torben Haslund [SMTP:Torben.Haslund@VBIOL.SLU.SE]
> Sent: Monday, February 21, 2000 10:13 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: macro variable more-than-8-char-problem
>
> Dear SAS-Lers,
>
> I use a macro variable which can take the value "intercept" - without
> quotes.
> But I also need to use it in an IF...THEN statement, and that does not
> work
> because it has more than 8 char. What should I do?
>
> %let intercpt = intercept;
> %put intercpt = &intercpt;
>
> data tst1;
> a=5;
> b=6;
> run;
>
> data tst2;
> set tst1;
> if &intercpt = intercept then pp=p+1;
> run;
>
>
>
> :::::::::::::::::::::::::::::::::
> Torben Haslund
> Department of Plant Biology
> Swedish University of Agricultural Sciences
> P.O. Box 7080
> S - 750 07 UPPSALA, Sweden
>
> E-mail address: Torben.Haslund@vbiol.slu.se
> Home and postal address: Ostre Paradisvej 7B,
> DK-2840 HOLTE, Denmark
> Phone home: +45 4541 1198
|