BookmarkSubscribeRSS Feed
Derdavos
Obsidian | Level 7

 Hello.

 

My problem is:

I have to summarize datas by monthly, and after by yearly, in separated tables. I also have to do it in EG (maybe querry), but I don't know how to solve this.

I have datas as month (januar-December) and year (2002-2004), income, and the name of product. I have to sum it monthly, and yearly. (of course in monthly I mean in the same year. so Jan 2002 can't be sum with Jan 2003). 

I attach a .txt file, with my expectation and the base data table.

 

I hope you can help me somehow. 🙂

 

Thank you.

 

ps. I am not allowed to code it. I have to use the GUI. 🙂

3 REPLIES 3
TomKari
Onyx | Level 15

So, step 1 is to convert the monthname to a number (January =1), etc. First use the "Create Format" task to create an infromat that will match the character values to the numeric. Then, in a query, use an advanced expression and the INPUT function to convert your character names to numbers.

 

Now, also in a query with an advanced expression, use the MDY function to convert your individual month, day, and year numeric values to a SAS date value.

 

From here on, run your tables using whichever tabulation procedure you like. For the annual table, apply the YEAR format to your date variable while building the table. For the monthly summary, use the YYMM format.

Reeza
Super User

1. In Query Builder create two new variables, one is year and one is month. Both are functions that can be created via compute column.

 

2. Use the Summarize task to build your summary table. For the annual use your year variable as your grouping variable, for monthly use the year and month as your group variables. 

 

 

Derdavos
Obsidian | Level 7

Thank you for your answers, both seems okay, but I found a solution as wells. It is a 'report maker' (?), if I am correct, because I don't have EN version. It summarize it by month, and by year if I select the year. 🙂

Anyways, thank you again! 🙂

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

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.

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
  • 3 replies
  • 4808 views
  • 0 likes
  • 3 in conversation