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 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 20 May 2004 14:18:15 -0700
Reply-To:     "Terjeson, Mark" <TERJEM@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Terjeson, Mark" <TERJEM@DSHS.WA.GOV>
Subject:      Re: a question of data manipulate.
Comments: To: June <spairz@YAHOO.COM>
Content-Type: text/plain; charset=us-ascii

Hi June,

I know this isn't exact just yet, but it is close. Instead of having "first" and "second" down the left side as the first two columns, this first draft has the "first" and "second" across the top as the first two rows. I just had a few minutes to get ya this close, I may or maynot have time to spend working out the above, so here ya go for part of it......

(maybe there's a chance this is enough)

data sample; input first second Q3A Q3B; cards; 1 2 3 4 1 2 6 10 1 2 5 3 2 4 6 4 2 4 7 8 2 4 4 5 3 7 3 7 3 7 1 6 3 7 5 8 3 7 4 9 4 8 8 1 4 8 9 2 ; run;

proc transpose data=sample out=temp1; run;

proc transpose data=temp1 out=temp2; id _name_; run;

proc transpose data=temp2 out=temp3; by first second; run;

data temp4; set temp3; name2 = trim(_name_)||'_'||compress(put(first,1.)); run;

proc transpose data=temp4 out=result_almost; id name2; run;

Hope this is helpful, Mark Terjeson Reporting, Analysis, and Procurement Section Information Services Division Department of Social and Health Services State of Washington mailto:terjem@dshs.wa.gov

-----Original Message----- From: June [mailto:spairz@YAHOO.COM] Sent: Thursday, May 20, 2004 11:08 AM To: SAS-L@LISTSERV.UGA.EDU Subject: a question of data manipulate.

Hi All, I have a data set like below: My data is sort by first. First and second is in the range 1 to 12. first second Q3A Q3B 1 2 3 4 1 2 6 10 1 2 5 3 2 4 6 4 2 4 7 8 2 4 4 5 3 7 3 7 3 7 1 6 3 7 5 8 3 7 4 9 .....

All the variables are numeric. Q3A and Q3B are splitted to 3 vaiables each by the range of First.

The final data set should look like this:

First Second Q3A_1 Q3A_2 Q3A_3 Q3B_1 Q3B_2 Q3B_3

1 2 3 . . 4 . . 1 2 6 . . 10 . . 1 2 5 . . 3 . . 2 4 . 6 . . 4 . 2 4 . 7 . . 8 . 2 4 . 4 . . 5 . 3 7 . . 3 . . 7 3 7 . . 1 . . 6 3 7 . . 5 . . 8 3 7 . . 4 . . 9

Does anyone could help me with this kind of manipulation? Thanks.


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