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 (August 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 3 Aug 2010 09:44:23 -0500
Reply-To:   "KRISHNAMURTHY, SUBASH [AG/1000]" <subash.krishnamurthy@MONSANTO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "KRISHNAMURTHY, SUBASH [AG/1000]" <subash.krishnamurthy@MONSANTO.COM>
Subject:   Re: Transposing data
Comments:   To: Billy Thompson <bill.thompson@BROOKS.AF.MIL>
In-Reply-To:   <201008031430.o73AoQtC021946@mailgw.cc.uga.edu>
Content-Type:   text/plain; charset="UTF-8"

This will do it, but not a very efficient way of doing this. I am sure there is a much easier way.

data test; input Time Rater Site $ Subj Question $ Response; cards; 1 1 A 1 q1 1 2 1 A 1 q1 1 1 1 B 1 q1 2 2 1 B 1 q1 0 ;

proc sort data = test; by Time rater Site Subj Question; proc tabulate data = test; class Time rater Site Subj Question response; tables Time*rater*Site*Subj*Question, Response*n; ods output table = Temp(drop = _TYPE_ _PAGE_ _TABLE_); run ;

proc transpose data = temp out=temp1(drop = _NAME_) prefix=R; by Time rater Site Subj Question; id response; var n;run ;

-SK -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Billy Thompson Sent: Tuesday, August 03, 2010 9:30 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Transposing data

On Tue, 3 Aug 2010 10:17:36 -0400, oloolo <dynamicpanel@YAHOO.COM> wrote:

>will this work? > >data newdata; > set olddata; > do Response_New=0, 1, 2; > output; > end; >run; >

Oloolo;

Unfortunately is doesn’t work. What your code does is create a new column (Response_New) with a series of 0, 1, 2’s. What I need are three columns i.e. Response_New_1 Response_New_2 Response_New_3 in which for each of 26 questions there appears the total frequency of each response. So

Time Rater Site QuestionResponse_New_1(0) Response_New_2(1) Response_New_3(2) 1 1 A 7 5 3 2 1 A 8 3 5

So then, the numbers in the response columns reflects the frequency of 0, 1, 2’s assigned across all subjects.

Time has 2 levels Rater has 2 levels Site has 5 levels.

Does this make more sense?

>On Tue, 3 Aug 2010 10:09:16 -0400, Billy Thompson ><bill.thompson@BROOKS.AF.MIL> wrote: > >>I have transposed my data to look like the following: >> >>Time Rater Site Subj Question Response >> >>1 1 A 1 q1 1 >>2 1 A 1 q1 1 >> >>etc. and so forth. >> >>What I need is for the first 5 columns to remain constant but my response >>column changed to 3 columns reflecting the frequency of the three possible >>responses 0, 1, 2 >> >>Can't seem to quite get this one worked out so any advice, suggestions, >>etc. would be appreciated.

Oloolo; Oloolo,

Unfortunately is doesn’t work. What your code does is create a new column (Response_New) with a series of 0, 1, 2’s. What I need are three columns i.e. Response_New_1 Response_New_2 Response_New_3 in which for each of 26 questions there appears the total frequency of each response. So

Time Rater Site QuestionResponse_New_1(0) Response_New_2(1) Response_New_3(2) 1 1 A 7 5 3 2 1 A 8 3 5

So then, the numbers in the response columns reflects the frequency of 0, 1, 2’s assigned across all subjects.

Time has 2 levels Rater has 2 levels Site has 5 levels.

Does this make more sense?

--------------------------------------------------------------------------------------------------------- This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited.

All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto, including its subsidiaries. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto, along with its subsidiaries, accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. ---------------------------------------------------------------------------------------------------------


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