12-12-2012 02:12 PM
I have upto 30 datasets. The number of variables changes everymonth, which ranges from 240-260. I have to create a total column for every eight columns/variables. How can I do that?
Thanks a lot
12-12-2012 02:23 PM
Without seeing your data, its probably not possible for me to write meaningful examples.
But what you can do is post your own code, and SASLOG, and the data, and I'm sure people will help you.
12-12-2012 02:34 PM
Right now, I just hard coded it.
%macro daily_total (dsn=);
data daily_tot_&dsn (keep=Category day1 day2 day3 day4 day5 day6 day7 day8 day9 day10
day11 day12 day13 day14 day15 day16 day17 day18 day19 day20 day21 day22 day23 day24
day25 day26 day27 day28 day29 day30 day31);
length total 8.;
format total 29.;
Not sure, which would be the best approach to go with that.
12-12-2012 02:49 PM
data daily_tot_&dsn(keep=category total day1-day&days_in_month);
length total 8; /* this line is completely unnecessary */
format total 29.; /* That's a very wide format */
%do ii=1 %to &days_in_month;
12-12-2012 03:59 PM
Thanks a lot for the code.
I am getting the following error.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. Does it mean that 'ii' is not resolving to number?
Need further help from the community? Please ask a new question.