Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Best way to merge multiple datasets with Unlike Var Names
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Lizette Koehler  
View profile  
 More options Apr 30 2008, 2:27 pm
Newsgroups: comp.soft-sys.sas
From: stars...@mindspring.com (Lizette Koehler)
Date: Wed, 30 Apr 2008 14:27:09 -0400
Local: Wed, Apr 30 2008 2:27 pm
Subject: Best way to merge multiple datasets with Unlike Var Names
I have two sas datasets that contain the same information but in different variable names.  I am having one of those moments where I cannot see how to do this.  Any help is appreciated.

Data  DS1;
  INPUT A $ B $ C $ ;
 Cards ;
  Small Tike  Red
  Med   Bike  Blue
  Large Bike  Red   ;;

Data DS2 ;
 INPUT X $ Y $ Z $ ;
  Cards ;
  Small 10.99 1yr
  Small 20.99 2yr
  Large 50.00 1yr
  ;;

Data AllDS ;
  Merge  DS1  DS2 ;
  (  Need Var A Merged and Var X -  The fields are alike but the variable name is different) ;
    By ? ;

Should come out

Small Tike RED  10.99 1yr
Small Tike Blue 20.99 2yr
Med   Bike Blue
Large           50.00 1yr

Thanks   Lizette


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wensui Liu  
View profile  
 More options Apr 30 2008, 2:31 pm
Newsgroups: comp.soft-sys.sas
From: liuwen...@GMAIL.COM (Wensui Liu)
Date: Wed, 30 Apr 2008 14:31:48 -0400
Local: Wed, Apr 30 2008 2:31 pm
Subject: Re: Best way to merge multiple datasets with Unlike Var Names
well, do you mind renaming the variable name?

On Wed, Apr 30, 2008 at 2:27 PM, Lizette Koehler

--
===============================
WenSui Liu
ChoicePoint Precision Marketing
Phone: 678-893-9457
Email : wensui....@choicepoint.com
Blog : statcompute.spaces.live.com
===============================

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jack Hamilton  
View profile  
 More options Apr 30 2008, 2:32 pm
Newsgroups: comp.soft-sys.sas
From: j...@stanfordalumni.org (Jack Hamilton)
Date: Wed, 30 Apr 2008 11:32:12 -0700
Local: Wed, Apr 30 2008 2:32 pm
Subject: Re: Best way to merge multiple datasets with Unlike Var Names
Use the data set option RENAME= to rename one (or both) of the input
variables.

> Data AllDS ;
>   Merge  DS1  DS2 ;
>   (rename=(x=a)) ;
>     By a ;

On Wed, 30 Apr 2008 14:27:09 -0400, "Lizette Koehler"
<stars...@MINDSPRING.COM> said:

--
Jack Hamilton
Sacramento, California
j...@alumni.stanford.org

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
"Howard Schreier  
View profile  
 More options Apr 30 2008, 11:29 pm
Newsgroups: comp.soft-sys.sas
From: hs AT dc-sug DOT org ("Howard Schreier)"
Date: Wed, 30 Apr 2008 23:29:33 -0400
Local: Wed, Apr 30 2008 11:29 pm
Subject: Re: Best way to merge multiple datasets with Unlike Var Names
On Wed, 30 Apr 2008 14:27:09 -0400, Lizette Koehler

<stars...@MINDSPRING.COM> wrote:
>I have two sas datasets that contain the same information but in different

variable names.  I am having one of those moments where I cannot see how to
do this.  Any help is appreciated.

name is different) ;

>    By ? ;

>Should come out

>Small Tike RED  10.99 1yr
>Small Tike Blue 20.99 2yr
>Med   Bike Blue
>Large           50.00 1yr

>Thanks   Lizette

You are commended for providing ready-to-use test data.

SQL can do this job without renaming or pre-sorting:

   proc sql;
   create table AllDS as
    select coalesce(ds1.a,ds2.x) as ax, b, c, y, z
     from ds1 full join ds2
      on ds1.a = ds2.x
    order by ax desc;
   quit;


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google