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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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