|
rss wrote:
> tanwan wrote:
> > Or you could add a month variable and a create a month format, and use
> > the ORDER = unformatted:
> >
> >
> > data md;
> > do dday='01Nov2004'd to today() by 13;
> > corr1 = ranuni(dday);
> > yea=year(dday);
> > monthv=month(dday);
> > output;
> > end;
> >
> > proc format;
> > value monthf
> > 1='Jan'
> > 2='Feb'
> > 3='Mar'
> > 4='Apr'
> > 5='May'
> > 6='Jun'
> > 7='Jul'
> > 8='Aug'
> > 9='Sep'
> > 10='Oct'
> > 11='Nov'
> > 12='Dec';
> >
> >
> > proc tabulate data = md noseps order = unformatted;
> > class monthv yea;
> > var corr1;
> > format monthv monthf.;
> > table (yea='' all='Month Avg.'),
> > (monthv='' all='Ann. Avg.')
> > * corr1='' * mean='' *f=comma6.4 / rts = 12 misstext='*';
> > run;
>
> I almost understand this but not quite. I need to do the proc tabulate
> on my original dataset. Let's call my origianl dataset MD. Your code
> overwrites the data:
>
> > data md;
> > do dday='01Nov2004'd to today() by 13;
> > corr1 = ranuni(dday);
> > yea=year(dday);
> > monthv=month(dday);
> > output;
> > end;
>
> why are we setting up the do dday from 01nov2004 to today() by 13?
> won't this give me Nov2004, Dec2005 and Jan2006 -> the by 13 causes the
> loop to count this way doesn't it?
>
> don't we want to have year= 1997 to 2006
> month = Jan through Dec __> how do I
> specify this?
>
> now if I have set this up if I have to put it into a dataset then how
> do I output my original data? Can I do something like:
>
> do year = 1997 to 2006
> month = $%%$^&*^&%$^
>
> this just isn't going to work. I don't understand what your code does
> and don't see how it connects back to my original data that I want to
> output. I wish someone could explain how to do this.
>
>
> The question remains.; How do you set up an internal format on the
> data.
also, if my original variable was corr1 you overwrite it in your
example. If we have it under a different name how do we access it in
the proc tabulate statement?
|