Date: Thu, 21 Dec 2006 11:22:52 -0600
Reply-To: Yu Zhang <zhangyu05@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Yu Zhang <zhangyu05@GMAIL.COM>
Subject: Re: Linking 2 datasets
In-Reply-To: <1166720551.477476.170140@n67g2000cwd.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Jared,
What I will do is to create a format using second dataset.
data fmt;
set dataset2;
retain fmtname 'fname' type 'n';
start=siteid;
label=sitename;
run;
proc format library=work cntlin=fmt;
run;
place this code before any of your report procedures. then still use the
siteid in your report statements, like define, class with option
format=fname.
HTH
Yu
On 12/21/06, webonomic <webonomic@gmail.com> wrote:
>
> I have 2 datasets:
>
> Dataset1:
> SiteID Q1 Q2
> 1 2.3 11002
> 2 4.7 39209
> 1 1.2 20983
> 3 2.2 40989
> 2 0.2 23492
> 4 0.7 10983
> 4 0.9 77549
> 3 2.1 29403
> 3 3.0 84302
>
> Dataset2:
> SiteID Name
> 1 Elmo
> 2 Ernie
> 3 Bert
> 4 Oscar
>
>
> (My real datasets have more observations and more variables.)
>
> Table 2 is only really used for Reporting purposes. Ie. to make
> reports more readable, I want to use the Name rather than the SiteID.
>
> What I usually do is create a Name variable in Dataset1 permanently and
> work with this permanent dataset. It works, but if the Name ever
> changes, I have re-run some programs to update the dataset. This does
> not seem ideal. I don't like hardcoding it into the dataset, nor would
> I want to create this variable everytime I want to do data analysis.
>
> So when I do Proc Tabulate or Proc Report and other procs on Dataset1,
> what methods are available to pull in the Name from Dataset2?
> Should I continue doing it the way I am used to? How do other people
> solve this?
>
> TIA,
>
> Jared
>
|