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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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