Hi everyone,
I had date variables of a certain test. You've helped me before in converting this to only month-year variable by using yymon7., but after lookign at the counts, it turned I need to convert it to a quarterly date to make the counts larger, to do a time series analysis later. I need the date to be instead of jan2016, Feb2016 with their counts to be Quarterly.
I have many questions:
Q1. I've tried proc expand to convert the time from month to QTR and it didn't work.
proc expand data=monthly out =quarterly.
from =month to =QTR;
convert feecode;
id date;
run;
Also tried q_date= QTR(date) and it just gave me number 1, 3....
Q2) I need to make time slices at certain intervention dates for a time series analysis, any one has a useful codes for these? I know it is complicated. If just a link for a useful coding source.
Thank you so much,
Lamia
Formats such as YYQ6. show date value as 2017Q1, yyQx allows you to specify character such as - / . <blank> or : between year and quarter number, YYQR displays the quarter as a Roman numeral yyqr7. would show 2017QI through 2017QIV, and the YYQRX uses the roman numeral plus a specified character as the yyqx does.
Or roll your own with Proc Format.
Look at the formats available and I'm 99% sure there's a year quarter one. Use that instead.
This page has the formats by category, so in the Date/DateTime section, find one that does what you want.
Formats such as YYQ6. show date value as 2017Q1, yyQx allows you to specify character such as - / . <blank> or : between year and quarter number, YYQR displays the quarter as a Roman numeral yyqr7. would show 2017QI through 2017QIV, and the YYQRX uses the roman numeral plus a specified character as the yyqx does.
Or roll your own with Proc Format.
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.