04-06-2017 11:42 AM
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.
ps. I am not allowed to code it. I have to use the GUI.
04-06-2017 04:29 PM
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.
04-06-2017 06:08 PM
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.
04-07-2017 03:11 AM
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!