BookmarkSubscribeRSS Feed
HansSteenhuis
Calcite | Level 5

Hello everyone,

 

Is it possible to apply this function that I have in Excel in EG?

 

NUMBER CODE IF statement
1410647 313  
1410647 322 313
1411948 313  
1411948 320 313
1411950 322  
1411950 303 322
1412210 318  
1412210 313 318
1412210 320 313
1412210 312 320
1598745 314  
1598745 380 314
1598745 312 380
1598745 314 312
1598745 380 314
1598745 380 380
1598745 314 380
1598745 380 314

 

regards,

 
 

Hans

 

1 REPLY 1
jebjur
SAS Employee

I think you can use a combination of BY group processing and the LAG function to get the results you want.

 

proc sort data=one;
by number;
run;

 

data two;
set one;
by number;
y=lag(code);
if first.number then y=.;
run;

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!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 388 views
  • 0 likes
  • 2 in conversation