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 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 19 Mar 2004 10:44:35 -0800
Reply-To:     "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:      Re: transposing variable
Comments: To: 0101 htns <htns0101@YAHOO.COM>

data one; id='111'; var='wk1'; visit=1; output; id='111'; var='wk2'; visit=2; output; id='111'; var='wk3'; visit=1; output; id='111'; var='wk4'; visit=3; output; id='222'; x='wk1'; visit=1; output; id='222'; x='wk2'; visit=2; output; id='333'; x='wk1'; visit=2; output; run;

proc transpose data = one out = two prefix = wk; by id; run;

data two; set two; array num _numeric_; do over num; if num=. then num=0; end;

proc print data =two; run;

good luck

Paul Choate DDS Data Extraction (916) 654-2160

-----Original Message----- From: 0101 htns [mailto:htns0101@YAHOO.COM] Sent: Friday, March 19, 2004 9:12 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: transposing variable

Hi all,

anybody know a efficient way to fix the missing values. Thank you

"Choate, Paul@DDS" <pchoate@DDS.CA.GOV> wrote:You'll need to fix the missing values.

data one; id='111'; var='wk1'; visit=1; output; id='111'; var='wk2'; visit=2; output; id='111'; var='wk3'; visit=1; output; id='111'; var='wk4'; visit=3; output; id='222'; var='wk1'; visit=1; output; id='222'; var='wk2'; visit=2; output; id='333'; var='wk1'; visit=2; output; run;

proc transpose data=one out=two prefix=wk; by id; run;

proc print data=two; run;

hth

Paul Choate DDS Data Extraction (916) 654-2160

-----Original Message----- From: 0101 htns [mailto:htns0101@YAHOO.COM] Sent: Friday, March 19, 2004 8:44 AM To: SAS-L@LISTSERV.UGA.EDU Subject: transposing variable

Dear SAS-Lers,

I need to transpose the below data.

data one;

id='111';var='wk1';visit =1;output;

id='111';var='wk2';visit =2; output;

id='111';var='wk3';visit =1;output;

id='111';var='wk4';visit=3; output;

id='222'; x='wk1';visit=1; output;

id='222'; x='wk2';visit=2; output;

id='333'; x='wk1';visit=2; output;

run;

here's the expected result

id _NAME_ wk1 wk2 wk3 wk4

111 visit 1 2 1 3

222 visit 1 2 0 0

333 visit 2 3 0 0

Thank you in advance.

Huong

Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam

Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam


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