Date: Sat, 20 Nov 1999 21:09:19 -0500
Reply-To: yklein@brooklyn.cuny.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Yehuda Klein <yklein@J51.COM>
Organization: Brooklyn College
Subject: Re: Reshaping SAS datasets
Content-Type: text/plain; charset=us-ascii
I would like to thank everyone who replied. The key issue is the label part
of the problem. Several people have suggested that I use call label (var1,
var2), which reads the label from var1 and assigns it as the value of the
character variable var2.
Question: will call label run on SAS 6.12 or is it a new feature of SAS 7/8.
Thanks again.
Y Klein
"J. Schroeder" wrote:
> Yehuda:
>
> I don't have enough information about the label part of your problem,
> but the rest is easy.
>
> Data Newfile;
> set oldfile;
> keep name date label value;
> label = [????];
> value = var1;
> output;
> label = [????];
> value = var2;
> output;
> label = [????];
> value = varn;
> output;
>
> if you do not know how many var1-varn you will have, you will need to
> set up a loop the will
> repreat the equality statements above 'N' times.
>
> Yehuda Klein wrote:
> >
> > I have a dataset in the following form:
> >
> > Name Date Var1 Var2 Var3 .... Varn
> >
> > I would like to create a new dataset with n observations for each
> > initial observation:
> >
> > Name Date Label1 Value1
> > Name Date Label2 Value2
> > ...
> > Name Date Labeln Valuen
> >
> > For each observation in the new dataset, I need to extract the label and
> > value of one of the variables var1--varn in the original dataset.
> >
> > Any thoughts on how to code this problem in base SAS would be
> > appreciated.
|