LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 13 Jul 2004 08:25:10 -0700
Reply-To:     Wini <wottoy@ADVALVAS.BE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Wini <wottoy@ADVALVAS.BE>
Organization: http://groups.google.com
Subject:      SAS Macro - merge
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I have a problem with merging datasets within a macro. I would like to retain for each survey (in fact it are waves) the indid. Therefore I create indidX = indid. For a wave were the indid is present I would like to have that indid else a missing, but the only thing I get is a matrix with all indids. (it seemst that the value from the first datset, a list of all possible indids) is retained.

The indid is called indid in all files, but I like to have a file with indid1 indid2 indi3

suppose contac contains

indid 1111 1245 2548 3655

wave1 contains a datset with

indid

1245 3655

wave2 contains a datset with

1245 2548

then I would like to have a dataset with

indid indid1 indid2 1111 . . 1245 1245 1245 2548 . 2548 3655 3655 .

What is wrong with this code?

%macro comb(bib,dsn,iniw,endw,sortvar,target,vars); data &target; set contac; run; %do i=&iniw %to &endw; data &target(keep= indid &vars&iniw-&vars&i ); merge &bib&i..w&i.&dsn &target ; by &sortvar; &vars.&i=indid; run; %end; %mend;

%comb(wave,adult,1,3,indid,test,indid);

Thanks in advance!


Back to: Top of message | Previous page | Main SAS-L page