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 (May 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 9 May 2006 13:43:18 -0700
Reply-To:   "Huang, Ya" <Ya.Huang@AMYLIN.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Huang, Ya" <Ya.Huang@AMYLIN.COM>
Subject:   Re: sql join or datastep merge question
Comments:   To: Jake Booter <jakeboot@GMAIL.COM>
Content-Type:   text/plain; charset="iso-8859-1"

The output was from testing of Toby's code, mine should looks likes this:

patient visit value

1 1 . 1 2 345 1 3 287 2 1 . 2 2 105 2 3 .

Where visit is not missing.

-----Original Message----- From: Ya Huang [mailto:ya.huang@AMYLIN.COM] Sent: Tuesday, May 09, 2006 1:41 PM To: SAS-L@LISTSERV.UGA.EDU; Jake Booter Cc: Huang, Ya Subject: Re: sql join or datastep merge question

You have received two SQL solutions, of which Toby's solution is quite interesting, unfortunately you'll get missing value for the visit. I have here a data step solutions, need two step though:

data xxx; input patient visit value; cards; 1 2 345 1 3 287 2 2 105 ;

data yyy; input visit; cards; 1 2 3 ;

data zzz; if 0 then set yyy nobs=nobs; set xxx; by patient; if first.patient then do; do i=1 to nobs; set yyy point=i; output; end; end; drop value; run;

data xxx; merge xxx zzz; by patient visit; run;

proc print; run;

patient visit value ---------------------------- 1 . . 1 2 345 1 3 287 2 . . 2 2 105 3 . .

HTH

Ya

On Tue, 9 May 2006 16:05:09 -0400, jakeboot@gmail.com <jakeboot@GMAIL.COM> wrote:

>I have data as follows: >patient visit value >--------- ------ ------- >1 2 345 >1 3 287 >2 2 105 > >but I have a template of expected visits as: >visit >----- >1 >2 >3 > >Is there a way via merge or sql where I can use the template to obtain the >following? >patient visit value >--------- ------- -------- >1 1 . >1 2 345 >1 3 287 >2 1 . >2 2 105 >2 3 . > >Thanks, for any information or techniques on this. > >Jake >--


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