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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register 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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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