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
Opal | Level 21

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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 568 views
  • 0 likes
  • 2 in conversation