| Date: | Tue, 3 Jun 2008 15:34:18 -0500 |
| Reply-To: | Tim Kynerd <tkynerd@ECD.ORG> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Tim Kynerd <tkynerd@ECD.ORG> |
| Subject: | FW: A Complex Tranpose or Data manipulation Question. Very Urgent
- Please |
| Content-Type: | text/plain; charset="us-ascii" |
Also, that was a hair hasty. You'll probably want a LENGTH statement, similar to this:
length Week Month $20;
between the DATA and SET statements in the code I provided. Otherwise, they may end up too short. (They may well not need to be 20 long, but you can decide that yourself; I'm just recommending that you set the length explicitly.)
Best,
Tim
Tim Kynerd
Computer Programmer/Analyst
ECD/HOPE
4 Old River Place, Suite A
Jackson, MS 39202
P: (601) 944-9308
F: (601) 944-0808
tkynerd@ecd.org
-----Original Message-----
From: Tim Kynerd
Sent: Tuesday, June 03, 2008 3:23 PM
To: 'Tom Smith'
Subject: RE: A Complex Tranpose or Data manipulation Question. Very Urgent - Please
Hi Tom,
Here's the easiest way I know of:
data newds;
set oldds;
keep Person Section Week Month;
Section = 'Cognitive';
Month = cognitiveMonth;
Week = cognitiveWeek;
output;
Section = 'Attention';
Month = AttentionMonth;
Week = AttentionWeek;
output;
run;
If you really want Person to be missing on the second observation in each group, you can of course set it to missing in the code somewhere between the two OUTPUT statements, but I think it's better practice to keep it in the data and find a way to suppress it when you prepare printed output, if desired/necessary.
Best,
Tim
Tim Kynerd
Computer Programmer/Analyst
ECD/HOPE
4 Old River Place, Suite A
Jackson, MS 39202
P: (601) 944-9308
F: (601) 944-0808
tkynerd@ecd.org
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Tom Smith
Sent: Tuesday, June 03, 2008 3:15 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: A Complex Tranpose or Data manipulation Question. Very Urgent - Please
I have a dataset with the following variables:Person, cognitiveweek,
Attentionweek,
cognitiveMonth, AttentionMonth as below:
Person cognitiveweek Attentionweek cognitiveMonth AttentionMonth
---------------------------------------------------------------------------
101 no symtom morderate very mild very mild
102 sever very mild morderate no sumptom
104 morderate sever no sumptom very mild
in the new dataset a new variable will be Section, week and month and
after transpose
it will be as below:
Person Section Week Month
----------------------------------------------------
101 cognitive no symtom very mild
Attention morderate very mild
102 cognitive sever morderate
Attention very mild no sumptom
104 cognitive morderate no sumptom
Attention sever very mild
Can anyone please help to do solve it in as short as possible?
Thanks a lot from the bottom of my heart. Please do not feel offensive if
I had
ask a question that is too easy for you. I really need this help. PLEASE
This transmission is intended only for the use of the addressee and may contain information that is privileged, confidential, and exempt from disclosure under applicable law. If you are not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately via e-mail at support@ecd.org.
|