BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PaigeMiller
Diamond | Level 26

@jgos wrote:

Hi PaigeMiller,

I replace have2 with my input data and it returned with an error

 

Variable date is not on file WORK.QUERY_FOR_ACTS_MONTHLYTOTALS

 

My input data has following columns for date :

YR : e.g 2019

MT : e.g 10

Month : e.g October

Quarter : e.g 2019-q4


But you have to create data set HAVE2, because in the creation of HAVE2, variable DATE is created. You can't leave out that important step.

--
Paige Miller
jgos
Calcite | Level 5
Thank you PaigeMiller. I modified it a little and it works the way I want it.
Reeza
Super User
I would not do this in SQL at all, why not use PROC MEANS which could do this by default without all of the manual coding here. What happens when new quarters are added? You'll need to update this code for each iteration.

PROC TABULATE will create this very nicely for you without all of this and will scale as the data changes. Ideal if you need a report especially and not a data set. If you need a data set I'd still use PROC TABULATE and store the results and then transpose them so it's still dynamic.
jgos
Calcite | Level 5

Hi Reeza,

 

As per you proc means will be more suitable based on my requirement? Can you show me what would code look like in my case?

 

Thanks

SAS Innovate 2025: Save the Date

 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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 18 replies
  • 2951 views
  • 4 likes
  • 3 in conversation