Hi.
I have a continuous variable, called earnings per share (eps) that ranges from -0.65 to +0.75 (no of obs. 710, period 2000-2017). I need to create a new variable that represents equal intervals with a width of 0.01. A sample of data goes like this:
Id year eps
1 2000 0.023
1 2001 0.14
1 2002 0.26
1 2003 -0.15
.
.
1 2017 0.025
2 2000 0.14
2 2001 -0.70
2 2002 0.28
2 2003 -0.149
etc.
Your assistance is highly appreciated.
Thank you.
Ali
Can you show us from your posted data what that variable would look like? How is it calculated?
I am attaching a sample of my data.
Thank u for your prompt response.
Ali
Please post example data in a usable form, namely in a data step with datalines, like
data have;
input id year eps;
datalines;
1 2001 0.0398969682690857
1 2002 0.0322152271922031
1 2003 0.046485718845387
;
run;
And show what you expect out of it as a result.
Creating a new variable is easy, but useless:
data want;
do _n_= -65 to 75;
new_variable = _n_ / 10;
output;
end;
run;
I promise, nobody reading your post can possibly tell how this new variable relates to your original data. You will have to explain using an example or two that illustrates the result you would like to achieve.
Hello,
I am trying to test whether the distribution of earnings per share (eps) is smooth. The definition of smoothness used is that the number of observations of eps in a given interval (i) expected to be the average of the intervals i-1 and i+1. The test statistic for smoothness is the difference between the expected and actual number of observations in an interval divided by the estimated standard deviation.
So, my problem is how to create these equal intervals with width of 0.01.
Thanks again.
So what would you like your data to look like, so that you can perform the analysis?
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: