This is what I got:
21
22 GOPTIONS ACCESSIBLE;
23 data EMpull;
24 set OUTPAT;
25 where ( '99201' <= cpt <= '99215')
26 or (cpt between '99241' and '99245')
27 or (cpt between '99381' and '99397')
28 or (cpt between '99354' and '99355')
29 or (cpt between '99401' and '99412');
30
31 QTR=qtr(eventDate);
32 YEAR_QTR = put(eventDate,yyq6.);
_____
484
NOTE 484-185: Format $YYQ was not found or could not be loaded.
33 if year_qtr in ('2021Q1' '2021Q2');
34
35 /*QTR=catt("Q", qtr('01Jan2021' <= eventDate <= '31Mar2021'));
36
37 /*YEAR_QTR = put(('01Jan2021' <= eventDate <= '31Mar2021'), yyq6.);*/
38
39 RUN;
That is saying that you cannot use the YYQ format with a character variable. Your dates need to be actual DATE values to use date operations. SAS stores dates as the number of days since 1960.
So perhaps the first thing you need to do is convert eventDate into an actual DATE.
What types of strings does it contain? Find the right informat that will convert string in that style into date values and use the INPUT() function.
There are only two quarters in my data - Jan - jun - q1 and q2; there is no q3 or q4.
The YEAR-QTR column is giving me year month and thats after i changed the q6. to q7. - q6. only gave me 2021-0 and no month number wher as q7. gave me 2021-03 for March 2021.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.