BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I need help in SAS Enterprise Guide. I have a table containing current and historical data. The data is in the same column as such:

date name value
7/5 John 5
current John 10

I need SAS to return the difference. If there is no difference, then it won't return a value.

Any help would be greatly appreciated.


Thanks,
2 REPLIES 2
datalligence
Fluorite | Level 6
Not very sure of what you exactly want but i think you can try using the first.variable_name, last.variable_name, and the lag function.

data yourdata;
by name date;
if first.date <> last.date then;
diff_date=date-lag(date);
diff_value=date-lag(value);
....
....

Thanks,
Romakanta
deleted_user
Not applicable
Thanks Romakanta.

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!

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