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 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 2 Mar 2007 11:40:20 -0500
Reply-To:     Jack Clark <JClark@CHPDM.UMBC.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jack Clark <JClark@CHPDM.UMBC.EDU>
Subject:      Re: Help for the data step!
Comments: To: Jane <program.sas@GMAIL.COM>
Content-Type: text/plain

Jane,

I wasn't sure if the m1, m2, m3, etc were the names of the variables or the values of the variables. Here is a simplistic DATA step approach that should do what you want.

data test; length m1-m3 $2 s1-s3 $2 n1-n3 $2; input m1-m3 s1-s3 n1-n3; cards; m1 m2 m3 s1 s2 s3 n1 n2 n3 ; run;

data new (keep=mvar svar nvar); set test; mvar = m1; svar = s1; nvar = n1; output; mvar = m2; svar = s2; nvar = n2; output; mvar = m3; svar = s3; nvar = n3; output; run;

Jack Clark Research Analyst Center for Health Program Development and Management University of Maryland, Baltimore County

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Jane Sent: Friday, March 02, 2007 11:10 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Help for the data step!

Hi All

I have a dataset with only one row data. looks like this:

m1 m2 m3 s1 s2 s3 n1 n2 n3

I want to output like this:

m1 s1 n1 m2 s2 n2 m3 s3 n3

How can I do this job in data step?

Thank you very much!

Jane


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