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 (March 1998, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 5 Mar 1998 08:58:18 -0600
Reply-To:   hmclean@peach.fruit.com
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Hays McLean <Hmclean@PEACH.FRUIT.COM>
Organization:   Fruit of the Loom
Subject:   Re: Merging datasets with common vars
Content-Type:   text/plain; charset=us-ascii

Thanks for all of the responses to this question, which provided me with several interesting ideas. My original question was to try to do this problem without having to painfully code a big keep or drop statement since variables are frequently changing.

However, from the responses, I got some good ideas on how to relatively painlessly automate a keep statement to do what I need.

I especially like the approach, suggested by Frank Poppe, to create a macro variable in Proc SQL by accessing the DICTIONARY.COLUMNS table (I've never known about this table before, but it seems to work):

proc sql noprint ; select trim ( left ( name ) ) into :keeplist separated by " " from dictionary.columns where libname='yourlib' and memname='first' ;

and use the &keeplist macro variable in a keep= option in a simple merge statement.

Thanks.

--Hays McLean

I wrote: >I have two datasets. One contains 100 variables, the other contains >these 100 plus 900 more. > >I want to update the variables in the first dataset with the data from >the common variables in the second dataset. But, I don't want the other >900 in the first dataset. > >In effect, I want to Merge Data1 Data2 to replace all variables in the >1st with the data from the second. > >Is there a way to do this without coding a big drop statement? > >Thanks. > >--Hays McLean


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