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 (July 2010)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 12 Jul 2010 01:12:36 -0400
Reply-To:     Richard Ristow <wrristow@mindspring.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Richard Ristow <wrristow@mindspring.com>
Subject:      Re: how to restructure data file
Comments: To: Martin Sherman <MSherman@loyola.edu>
Comments: cc: Bruce Weaver <bruce.weaver@hotmail.com>,
          Gene Maguin <emaguin@buffalo.edu>, Albert-Jan Roskam <fomcl@yahoo.com>
In-Reply-To:  <29100003.post@talk.nabble.com>
Content-Type: text/html; charset="us-ascii"

<html> <body> At 07:14 PM 7/7/2010, Bruce Weaver wrote:<br><br> <blockquote type=cite class=cite cite="">Gene &amp; Albert-Jan, I don't think your solutions are creating all of the variables that Martin wants.&nbsp; I think you need to do something like the following--although there are no doubt more elegant ways to do it!</blockquote><br> Bruce notes that the problem is to create variables for sessions that are provided for in the study, but for which no subject in the file has any data. CASESTOVARS can roll up the file and create variables for all sessions that <i>are</i> there, but not for all that <i>could be</i> there.<br><br> Bruce's solution is, using a macro, to create a dummy record (for 'subject' 00) containing all the desired variables, and catenate this ahead of the file actually created.<br><br> An alternative (not tested) is to create and catenate the dummy subject <i>before</i> the <tt><font size=2>CASESTOVARS</font></tt>, using <tt><font size=2>LOOP</font></tt> and <tt><font size=2>XSAVE</font></tt>. It's similar logic, but it takes less code. <b>NOT TESTED:<br><br> </b><tt><font size=2>*&nbsp; This requires that the original data be in dataset DATA, .<br> *&nbsp; and a scratch file (not dataset) named DUMMY be available.<br><br> <br> *&nbsp; Initial dummy record, as Bruce had it.<br> data list list / ID(a2).<br> begin data<br> 00<br> end data.<br><br> *&nbsp; XSAVE loop to create 'records' for sessions 1 to 25 .<br> *&nbsp; (These records don't need variables a1 to c6; those .<br> *&nbsp; will be added when the files are catenated.)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .<br><br> LOOP Session = 1 TO 25.<br> .&nbsp; XSAVE OUTFILE=Dummy.<br> END LOOP.<br> EXECUTE /* This one is needed */.<br><br> *&nbsp; Catenate dummy and real data:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .<br> ADD FILES<br> &nbsp; /FILE=Dummy<br> &nbsp; /FILE=DATA.<br><br> *&nbsp; Now CASESTOVARS should give what is wanted:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .<br> * (I've copied Gene's CASESTOVARS and Bruce's SELECT IF).<br><br> casestovars id=id/index=session.<br> select if (ID NE &quot;00&quot;).</font> </body> <br> </html>

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


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