I was able to import data from Excel to SAS and it's now in this format:
Quarter Variable1 Variabl2
201201 1 2
201202 1 2
201203 4 1
201204 5 1
....
201804 5 8
They are all in number format (even the Quarter column values). How do I convert the quarter column's values to a Quarterly date
format?
The final goal is to get the seasonal factors but need to set the dates correctly first.
Thanks in advance!
Yes.
Here's one method to convert it to a SAS date.
data have; quarter = 201201;output; quarter = 201202;output; quarter = 201203;output; quarter = 201204;output; run; data want; set have; qtr_char = catx('Q', substrn(quarter, 1, 4), substrn(quarter, 6, 1)); date = input(qtr_char, yyq6.); format date yyqd6.; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Save the date!
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.