BookmarkSubscribeRSS Feed
mmh
Obsidian | Level 7 mmh
Obsidian | Level 7

Hello,
I am a new SAS user.
I have the following dataset:

data have;
input Company_ID $4. Date Fiscal_Year;
informat Date date9.;
format Date date9.;
cards;
1210 31mar2009 2009
1210 31may2010 2010
1210 30jun2010 2011
1211 31jan2009 2009
1212 26feb2010 2010
1212 31may2011 2011
1213 30jun2006 2006
1213 27jul2007 2007
;
run;

I want to create a dataset which will contain the observation under a certain Company_ID only for the last Fiscal_Year.
You can ignore the Date column.
As you will notice, for Company_ID 1211, there is only one observation for Fiscal_Year 2011.
Thus, it will remain as it is.
However, for Company_ID 1210, only the observation from Fiscal_Year 2011 will remain.
I am expecting the following output:

Company_IDDateFiscal_Year
121030JUN20102011
121131JAN20092009
121231MAY20112011
121327JUL20072007

 

Thank you so much for your kind support!

2 REPLIES 2

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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
  • 443 views
  • 3 likes
  • 2 in conversation