BookmarkSubscribeRSS Feed
SAS_inquisitive
Lapis Lazuli | Level 10

 Hello,

 

Are below two DATA step (test1, test2) same ? I am assuming the NOT FIRST.ID  is implied in test2.

 


data test;
input id x;
cards;
1 2
1 2
2 3
2 2
;
run;

data test1;
set test;
by id;
retain val;
if first.id then val = 1;
else if not first.id and x > 1 then val = 5;
run;

data test2;
set test;
by id;
retain val;
if first.id then val = 1;
else if x > 1 then val = 5;
run;
1 REPLY 1
Reeza
Super User

Yes, because the only way to enter the second condition is if it's not first.ID. 

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 608 views
  • 1 like
  • 2 in conversation