BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
starkey09
Calcite | Level 5

I have a large dataset in excel to sort for firms stock data. On one sheet I have returns, sheet 2 has market cap, sheet 3 has dividend yield. Because not all companies pay dividends, I need to delete firms that are not included on the dividend yield sheet. Is there a procedure I can run in sas that will only count firm data that is included in all dataset sheets?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Your code doesn't match mine. I have select * which means select everything and you have select name, which selects only the name variable. Please post your code and results as texts, trying to read code off images is not fun.

 


@starkey09 wrote:

Thanks. That works to filter the names. However, the data that is attributed to each of those firm names is missing. The result gave me just a list of the names on the data set. I have attached a photo- perhaps I made an error?DIV.PNGTRNZX.PNGFiltered.PNG


 

View solution in original post

4 REPLIES 4
Reeza
Super User

You can filter your data relatively easy via PROC SQL.

It would be as a simple as

Proc sql;
Create table filtered as
Select * from returns
Where firm in (select distinct firm from dividend);
Quit.

You would have to replace the table and variable names as appropriate.


@starkey09 wrote:

I have a large dataset in excel to sort for firms stock data. On one sheet I have returns, sheet 2 has market cap, sheet 3 has dividend yield. Because not all companies pay dividends, I need to delete firms that are not included on the dividend yield sheet. Is there a procedure I can run in sas that will only count firm data that is included in all dataset sheets?


 

starkey09
Calcite | Level 5

Thanks. That works to filter the names. However, the data that is attributed to each of those firm names is missing. The result gave me just a list of the names on the data set. I have attached a photo- perhaps I made an error?DIV.PNGTRNZX.PNGFiltered.PNG

Reeza
Super User

Your code doesn't match mine. I have select * which means select everything and you have select name, which selects only the name variable. Please post your code and results as texts, trying to read code off images is not fun.

 


@starkey09 wrote:

Thanks. That works to filter the names. However, the data that is attributed to each of those firm names is missing. The result gave me just a list of the names on the data set. I have attached a photo- perhaps I made an error?DIV.PNGTRNZX.PNGFiltered.PNG


 

starkey09
Calcite | Level 5

Thank you very much. That has worked perfectly.

sas-innovate-2024.png

📢

ANNOUNCEMENT

The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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.

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
  • 4 replies
  • 682 views
  • 1 like
  • 2 in conversation