BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi, I use the code below :
data revenue2;
set CAT_SORT;
if Good = "A" THEN
Margin = 10*Unit;
if Good = "B" AND
"01/01/2001"<=Date<="31/01/2001" THEN
Margin = 20*Unit;
IF Good = "B" AND
"01/02/2002"<=Date<="28/02/2002" THEN
Margin = 30*Unit;
RUN;


Is there a change that you could sugeest so that I use the IF twice only, that is, use Good="B" only once.

Kind Regards,
Mar
2 REPLIES 2
Peter_C
Rhodochrosite | Level 12
> Hi, I use the code below :
> data revenue2;
> set CAT_SORT;
> if Good = "A" THEN
> Margin = 10*Unit;
> if Good = "B" AND
> "01/01/2001"<=Date<="31/01/2001" THEN
> Margin = 20*Unit;
> IF Good = "B" AND
> "01/02/2002"<=Date<="28/02/2002" THEN
> Margin = 30*Unit;
> RUN;
>
>
> Is there a change that you could sugeest so that I
> use the IF twice only, that is, use Good="B" only
> once.
>
> Kind Regards,
> Mar

MarkC
you need to rephrase your message as it is not appearing correctly because of special symbols like <= avoid using < or <= by using LT or LE in syntax you post

Message was edited by: Peter.C
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Another option is to bookmark this link for future reference on forum posting guidelines with special-character content.

Also, for MarkC (and other posters) -- think before you post, particularly when selecting a forum, rather than simply choosing the first one in the list -- honestly, you're not the only individual doing this but it's a gentle suggestion.

Scott Barry
SBBWorks, Inc.

Thread: [Off-topic] Forum Markup
http://support.sas.com/forums/thread.jspa?messageID=27609

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1276 views
  • 0 likes
  • 3 in conversation