Date: Tue, 14 Apr 2009 18:26:53 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: ods output
In-Reply-To: <ce1fb7450904141514l3bb954ai4c374bba6292bf41@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Ahhh, that's exactly what I was hoping for ... thanks!!
-Joe
On Tue, Apr 14, 2009 at 5:14 PM, ./ ADD NAME=Data _null_; <
iebupdte@gmail.com> wrote:
> I have use techniques similar to the following to achieve that result.
>
> data IWant;
> set dset;
> length name $32 level level2 $20 /*or more*/;
>
> * this way;
> name = scan(table,-1);
> level = vvalueX(name);
>
> ** or;
> level2 = coalesceC(of f_:);
> run;
> proc print;
> run;
>
>
> On 4/14/09, Joe Matise <snoopy369@gmail.com> wrote:
> > Hi,
> > I've been starting to use ODS OUTPUT, particularly with PROC FREQ.
> >
> > When you do
> > ods output onewayfreqs=dset;
> > proc freq data=sashelp.class;
> > tables height weight sex age;
> > run;
> > ods output close;
> >
> > The resulting dataset, dset, always has separate columns for every
> > variable. That is logical of course; but sometimes it is more useful to
> > have it more consolidated.
> >
> > I could do
> >
> > data want;
> > set dset;
> > keep name level freqency percent;
> > array vars height weight age;
> > do _n_ = 1 to dim(vars);
> > if not missing(vars[_n_]) then do;
> > name = vname(vars[_n_]);
> > level = vars[_n_];
> > output;
> > end;
> > end;
> > run;
> >
> > and accomplish this, but not only does that discard the sex column (which
> I
> > could additionally do separately of course, but that's irritating!) but
> it
> > also becomes onerous for large numbers of variables; and _numeric_ is
> > inefficient as well since you have all sorts of numeric variables other
> than
> > these (at least, frequency and percent).
> >
> > Is there a way to get ODS OUTPUT to give you all of it combined? Or is
> > there a better way to massage the resulting dataset? Or do I have the
> best
> > way already?
> >
> > Thanks,
> >
> > Joe
> >
>
|