data have;
informat company $15. roe 4.3 yymm yymm_e yymmn6.;
format yymm yymm_e yymmn6.;
input company$ roe yymm yymm_e ;
cards;a 0.05 198503 198603
a 0.03 198512 198603
a 0.3 198606 198703
b 0.4 198812 198902;
run;
The table structure I want should be as following .
Your start data is not the same as your last question. It appears as if for every record, you take the year, ignore the month portion and you create a record for every quarter for that year. This is my assumption of the logic, it does help if you can clearly state that.
Logic:
1. Take year for each record.
2. Loop through and create new quarters for each record
3. Output data.
The logic previously should be enough to get you started and the answer is below.
I am waiting on line, pls help me! Thanks a lot.
Your start data is not the same as your last question. It appears as if for every record, you take the year, ignore the month portion and you create a record for every quarter for that year. This is my assumption of the logic, it does help if you can clearly state that.
Logic:
1. Take year for each record.
2. Loop through and create new quarters for each record
3. Output data.
The logic previously should be enough to get you started and the answer is below.
Hi reeza , Thank you ver much . I did it in my last thread as you had taught, but i forgot set start-date. I have another question. In your code the start_time was the following, why can't I write 'start_time=yymm'?
start_date=intnx('year', yymm, 0, 'b');
Because it's not the start date of the year. You need to create a record for every quarter of the year. If you start at the date you have it's sometimes halfway through the year. Again, I'm making assumptions on what you've provided. The logic is ultimately yours.
@lixuan wrote:
Hi reeza , Thank you ver much . I did it in my last thread as you had taught, but i forgot set start-date. I have another question. In your code the start_time was the following, why can't I write 'start_time=yymm'?
start_date=intnx('year', yymm, 0, 'b');
OK, I really appreciate, thank you very much.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.