Date: Mon, 11 Nov 1996 16:44:52 +0500
Reply-To: Bernard Tremblay <bernard@CAPITALE.QC.CA>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Bernard Tremblay <bernard@CAPITALE.QC.CA>
Subject: Re: Help needed: Merging files
Hi,
Easy one. The first "set" bring the variables of "singlobs" in
the program vector but its the only one made to this sas-dataset.
So the variables of this sas dataset are "retained" in the program
vector until you read next observation (wich is never the case...).
When you read the next dataset "multobs" SAS add the variables of
this sas-dataset in the program vector. So, until there are some
variables with the same name that are from "singlobs", all variables
of "singlobs" remain unchanged.
You are in fact kind of fooling SAS. SAS think you want to read
two datasets in the same data step , wich is the case, but you read only
the first observation of the first sas-dataset.
Does it answer your question ?
Regards,
Bernard Tremblay
\\\|///
\\ - - //
( @ @ )
+------oOOo-(_)-oOOo----------+---------------------------------+
| Bernard Tremblay | Bureau: (418) 646-2401 |
| La Capitale | Maison: (418) 878-4447 |
| |Internet: bernard@capitale.qc.ca |
| | bertrem@quebectel.com |
+---------------Oooo----------+---------------------------------+
oooO ( )
( ) ) /
\ ( (_/
\_)
>>>From owner-sas-l@UGA.CC.UGA.EDU Mon Nov 11 15:51 EST 1996
>>>Mime-Version: 1.0
>>>Content-Description: Message Body
>>>Content-Transfer-Encoding: 7BIT
>>>Date: Mon, 11 Nov 1996 16:56:01 -0000
>>>From: Richard Paterson <rpaterso@QEDI.QUINTILES.COM>
>>>Subject: Re: Help needed: Merging files
>>>To: Multiple recipients of list SAS-L <SAS-L@UGA.CC.UGA.EDU>
>>>
>>>< Simon,
>>>
>>>
>>>
>>>< If you had a key variable to merge by, a merge would have been fine;
>>>
>>>< however, since you do not seem to have a key, you can "merge" the
>>>
>>>< non-keyed, single observation dataset with the multiple obs dataset
>>>
>>>< using the SET command in the following manner:
>>>
>>>
>>>
>>>< DATA NEW;
>>>
>>>< IF _N_=1 THEN SET SINGLOBS;
>>>
>>>< SET MULTOBS;
>>>
>>>< RUN;
>>>
>>>
>>>
>>>
>>>
>>>Hi, can anyone explain the theory of the above code ?
>>>
>>>
>>>
>>>Regards
>>>
>>>
>>>
>>>Richard
|