Date: Tue, 28 Dec 1999 15:10:39 +0000
Reply-To: roland.rashleigh-berry@virgin.net
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roland <roland.rashleigh-berry@VIRGIN.NET>
Organization: N/A
Subject: Re: A data step question
Content-Type: text/plain; charset=us-ascii
Sure,
data human;
set man(in=_m) woman(in=_w);
if _m then gender='M';
else if _w then gender='F';
run;
Roland
cpwong wrote:
>
> Hi Friends,
>
> Suppose I have two datasets: MAN (observations of man), WOMAN (obs of
> woman)
> Both datasets have 2 variables: NAME, AGE
>
> Now I would like to have a single dataset HUMAN
>
> DATA HUMAN;
> SET MAN WOMAN;
>
> But I want to have an additional variable GENDER. So that All MAN obs
> should have GENDER=M. All WOMAN obs should have =F.
>
> I know a stupid way is
>
> DATA MAN;
> SET MAN;
> GENDER='M';
>
> DATA WOMAN;
> SET WOMAN;
> GENDER='F';
>
> Can you teach a clever syntax to do this ?
>
> Thanks in advance.
> cp
|