BookmarkSubscribeRSS Feed
Augusto
Obsidian | Level 7


Hello,

 

I need to create a data set like that bellow.

 

where variable "a" need to be the value of the previous value of the variable "c" and so on.

 

b = a * anual/12; 

 

safra a b c anual
1 45.483.247.875 0 45.483.247.875 2,97%
2 45.483.247.875 112.571.038 45.370.676.837 2,97%
3 45.370.676.837 112.292.425 45.258.384.411 2,97%
4 45.258.384.411 112.014.501 45.146.369.910 2,97%
5 45.146.369.910 111.737.266 45.034.632.644 2,97%

 

Thanks

1 REPLY 1
Astounding
PROC Star

Getting A is straightforward:

 

data want;

set have;

a = lag(c);

if _n_=1 then a=c;

run;

 

Getting B a value of 0 can also be done (but requires a little more coding), if you are computing B as part of this step.  It might depend on what is in ANNUAL.  Is it character, with a value of "2.97%" or is it numeric with a value of 0.297?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 646 views
  • 0 likes
  • 2 in conversation