BookmarkSubscribeRSS Feed
GosuGarry
Calcite | Level 5

I have a dataset including company name, fiscal year, and fiscal quarter, and I am encountering an issue about data selection.

 

For example, there is a data set of a company in year 1980. There are four possible quarterly data named as Q1, Q2, Q3, and Q4, some of them missing.

 

Now, I want to get the latest one as if the company has all four data, I choose Q4. If the company has data Q2, and Q3, I will pick Q3. If the company has data Q1, and Q3, I will pick Q3, and so on.

 

Could anyone please tell me how to do this please. Thank you so much and happy thanksgiving.

2 REPLIES 2
Kurt_Bremser
Super User

Please supply usable example data (post a data step with a sufficient number of datalines), so we can get a picture of your data and have something to tinker around with.

 

Do you have only one observation per company and year/fiscal quarter, or do you have multiple observations for each such group?

GosuGarry
Calcite | Level 5

Thanks for your reply. I guess I just figured out the solution from my instructor. Thanks again.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 694 views
  • 0 likes
  • 2 in conversation