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. 🙂
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.
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.
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! 🙂
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.