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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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