BookmarkSubscribeRSS Feed
Yazeed_10
Calcite | Level 5

Hi SAS community,

 

I have a large dataset (2000 stocks) with 180 month observations. For each stock I have three variables, Returns, Market Cap and transection cost. 

 

I am trying to sort data initially based on transection cost to 4 groups (500 stocks in each group), with group-1 containing stocks with the lowest transection cost and Group-4 containing stocks with the highest transection cost. Then I would like to sort stocks in each group into 10 deciles based on the market cap and calculating returns of each of these deciles (for example decile-1 in group-1 has 50 stocks, so I want to calculate the returns of these stocks). I would like the machine to do the same procedure for each month, so finally I can calculate the average returns of each decile for the full period. 

 

For example: What I am trying to test is to see if stocks with the lowest transection cost and lowest Market Cap (Group-1, Decile-1) have higher average returns than stocks with highest transection cost and highest Market Cap (Group-4, Decile-10).

 

I know this is too much to ask.

 

Any ideas or suggestions how I may get this done will be appreciated.

 

Regards, 

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

1) Sort the data by transaction, then assign group based on a retained count up to 500, then add 1.

2) do this "deciles" thing based on a by group of month. 

Not sure what else we can provide with zero information.  Test data in the form of a datastep, required output etc.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 1 reply
  • 793 views
  • 0 likes
  • 2 in conversation