[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: Re: changing %IF condition
From: Nathan Temple <Nathan.Temple () KP ! ORG>
Date: 2012-06-28 21:35:21
Message-ID: OF5E204792.5D66CDF6-ON88257A2B.0076857A-88257A2B.0076961A () kp ! org
[Download RAW message or body]
Thanks, the "%unquote" was what I was looking for.
**************************
Nathan Temple
Sr. Data Consultant
Management Information & Analysis
tie line: 8-335-5665
from outside: 626-405-5665
fax: 626-405-3206
NOTICE TO RECIPIENT: If you are not the intended recipient of this
e-mail, you are prohibited from sharing, copying, or otherwise using or
disclosing its contents. If you have received this e-mail in error,
please notify the sender immediately by reply e-mail and permanently
delete this e-mail and any attachments without reading, forwarding or
saving them. Thank you.
From: "Fehd, Ronald J. (CDC/OCOO/OCIO/ITSO)" <rjf2@CDC.GOV>
To: SAS-L@LISTSERV.UGA.EDU
Date: 06/28/2012 02:13 PM
Subject: Re: changing %IF condition
Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
> From: Nathan.Temple@kp.org
> Sent: Thursday, June 28, 2012 2:22 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: changing %IF condition
>
> Hello,
>
> I have a statement with a "%IF":
>
>
> proc syslin data=pred outest=outpred;
> model runout_pdays =
> %if &period. <= 3 %then %do; edf_days %end;
> known_pdays;
> run;
>
>
> This works fine but I would like do test different conditions within the
%IF,
> for example I would like to do:
>
> %let regr_cond=%nrquote(&period. <= 4);
>
> proc syslin data=pred outest=outpred;
> model runout_pdays =
> %if ®r_cond. %then %do; edf_days %end;
> known_pdays;
> run;
>
> But I get an error:
>
> ERROR: A character operand was found in the %EVAL function or %IF
> condition where a numeric
> operand is required. The condition was: ®r_cond.
>
> How can I parameterize the %IF condition ?
>
> Thanks
%let regr_cond=%nrstr(&period. <= 3);
%let regr_cond=%nrstr(&period. <= 4);
*let regr_cond=%nrstr(&period. <= 5);
%if %unquote(®r_cond.) %then %do; edf_days %end;
or
%let periodN = 3;
%let periodN = 4;
*let periodN = 5;
%if &Period. <= &PeriodN. %then %do;
edf_days
%end;
Ron Fehd macro maven
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic