BookmarkSubscribeRSS Feed
Almutairi
Fluorite | Level 6

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

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Can you show us from your posted data what that variable would look like? How is it calculated?

Almutairi
Fluorite | Level 6

I am attaching a sample of my data.

 

Thank u for your prompt response.

 

Ali

Kurt_Bremser
Super User

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.

Astounding
PROC Star

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.

Almutairi
Fluorite | Level 6

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.

Astounding
PROC Star

So what would you like your data to look like, so that you can perform the analysis?  

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

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
  • 6 replies
  • 1688 views
  • 0 likes
  • 4 in conversation