Use a dataset option:
proc summary data=MYDATA (rename=(eventdate=year_qtr));
and use the new name in the CLASS and FORMAT statements.
Or use a LABEL statement.
I did this and that worked:
output out= EMpull2 (rename=(sum=QTR_COST real_date=year_qtr) ) ;
What type of variable is EVENTDATE? Run PROC CONTENTS on the source dataset and check.
Is the TYPE of the variable numeric or character?
If numeric is their any FORMAT attached to it? What FORMAT is attached?
If the variable is numeric with a format used for displaying dates (DATE, MMDDYY, YYMMDD, etc) then you have a date variable. Otherwise you will need to first convert EVENTDATE into date values.
If your variable has a DATE value then the QTR() function will return an integer from 1 to 4. You will need to check the YEAR of the date if you only want the first two quarters in 2021.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.