Hi everyone,
I have two of what I assume are basic questions.
1. I'm required to calculate the delta of variables i.e the changes in the variables from one fiscal year to the other. May I know the best way to handle this?
2. With other Softwares, like stata, there is a function one can use to indicate that their data is a panel one. My question: Is a there a function like that in SAS and does it matter if it is not indicated to SAS that the data is a panel one?
Thank you very much and I look forward from hearing from you.
Does the following reflect what you want to accomplish?:
data have; input fiscal_year x; cards; 2000 5 2001 3 2002 . 2003 1 2004 3 2005 2 ; data want; set have; delta=x/lag(x)-1; run;
Art, CEO, AnalystFinder.com
Here is an example to show you how to get fiscal year ( start from 01july).
data have;
do date='01jan2010'd to '01jan2014'd;
do stock=1 to 10;
ret=rand('normal');
ret1=rand('normal');
output;
end;
end;
format date date9.;
run;
data have;
set have;
year=year(intnx('year.7',date,0,'b'));
run;
proc sort data=have;
by stock year;
run;
Dear KSharp,
Thank you for the reply.
Actually, I'm not trying to get a fiscal year. I rather want to calculate the delta(change) of variables from one fiscal year to the other.
Eg.
fiscal year variable(x)
2000 5
2001 3
2002 .
2003 1
2004 3
2005 2
How to you calculate the delta(changes) in x for each of the fiscal years?
Thanks
Does the following reflect what you want to accomplish?:
data have; input fiscal_year x; cards; 2000 5 2001 3 2002 . 2003 1 2004 3 2005 2 ; data want; set have; delta=x/lag(x)-1; run;
Art, CEO, AnalystFinder.com
SAS has a panel procedure (in SAS/ETS).
Other than that, proc transpose is available to make files long or wide, and one can take advantage of number of statements and functions to calculate deltas depending upon how the data is structured (e.g., using arrays, the retain statement, or the lag function).
Art, CEO, AnalystFinder.com
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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.