Date: Wed, 11 Feb 2004 23:52:59 -0800
Reply-To: Herman Ament <h.ament@ORGANON.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Herman Ament <h.ament@ORGANON.COM>
Organization: http://groups.google.com
Subject: Re: merge
Content-Type: text/plain; charset=ISO-8859-1
Dear Jamil,
From the on line SAS-manual.
-------------------------------------------------------------------
Example 4: Merging a Single Observation with All Observations in a SAS
Data Set
An observation to be merged into an exisitng data set can be one that
is created by a SAS procedure or another DATA step.
In this example, the data set AVGSALES has only one observation:
data national;
if _n_=1 then set avgsales;
set totsales;
run;
--------------------------------------------------------------------
So the solution could be:
DATA C;
IF _N_ = 1 THEN SET B;
SET A;
RUN;
jibrahim@IR.UMSMED.EDU (Jamil Ibrahim) wrote in message news:<s02a07e7.033@GWIA1.UMSMED.EDU>...
> HI sas users:
> I need help in matching two files.
> sample:one file A has 5 obs with 25 vars. the other file B has only
> one obs with 7 vars I want this 20 vars in B to be merged with each obs
> in
> the first file A and form file AB.
> File A
> data a;
> NPUT @1 (q1-q20) (1.) @22 S_ID $CHAR4. @27 P_ID $CHAR4. @32 rot
> $CHAR1.
> @34 group $CHAR1. @36 date $CHAR6. ;
>
> 11111110111101100 11 0001 1111 1 4 020504
> 11111110111101101011 0001 1112 1 4 020504
> 1111111111110110 111 0001 1113 1 4 020504
> 1111111 111111111111 0001 1114 1 4 020504
> 11111111111101111111 0001 1115 1 4 020504
> ;
> file B
> INPUT
> @1 D1 $CHAR100./
> @1 D2 $CHAR100./
> @1 D3 $CHAR100./
> @1 D4 $CHAR100./
> @1 D5 $CHAR100./
> @1 D6 $CHAR100./
> @1 D7 $CHAR100.
> ;
> data b;
>
> 1. Used words I could understand (no medical jargon)
> 2. Used open-ended and closed-ended questions appropriately
> 3. Maintained eye contact much of the time but not excessively
> 4. Did not interrupt while I was talking
> 5. Checked out my feelings and concerns regarding my situation
> 6. Encouraged me to ask questions
> 7. Directly answered my questions and clearly explained things
> ;
>
> the results should be in data ab with 32 vars from both files;