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 2001)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 31 Mar 2001 07:38:09 -0500
Reply-To:     Raynald Levesque <rlevesque@VIDEOTRON.CA>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Raynald Levesque <rlevesque@VIDEOTRON.CA>
Subject:      Re: changing variable display properties (OOOOPSS!).
In-Reply-To:  <LDEEKLGKNMECOPKLIGJNCENFCBAA.rlevesque@videotron.ca>
Content-Type: text/plain; charset="us-ascii"

Hi guys (gals)!

OOPPS!

I need to add the following 2 comments to my earlier post.

1. Although the macro below is very useful, it is not necessary to solve the problem at hand. 2. The solution works even when there are strings variables scattered bettween the 1st and the 600th variable (there are error messages because the string variables cannot be "rounded" nor changed to the format F8.0 but the solution works anyway.)

** Revised Solution **

DATA LIST LIST /g(F8.2) x345(F8.2) str1(A8) v3(F8.2) b(F8.2) k(F8.2). BEGIN DATA. 1.21 2.49 "green" 3.01 5.51 41.98 2.33 5.67 "blue" 1.75 4.22 6.02 END DATA.

DO REPEAT v=g TO k. COMPUTE v=RND(v). FORMATS v(F8.0). END REPEAT PRINT. EXECUTE.

Regards

Raynald Levesque rlevesque@videotron.ca

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Raynald Levesque Sent: Friday, March 30, 2001 8:26 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: changing variable display properties.

Hi Paul and SPSS'ers!

The following is a general solution, it uses a macro I wrote recently:

* Some commands do not accept references such as var1 TO xyz5. * This macro produces a list of all variables between 2 given variables. * The macro is useful when there are hundreds of variables. * Because of a 'feature' of the macro parser, it is sometimes necessary to enclose the variable names in quotes. This is done in the macro qlist1 (see below). * (For the example here, qlist1 is not needed). * Raynald Levesque rlevesque@videotron.ca 2001/03/24.

*///////////////////////////////////////. DEFINE !DefList (var1=!TOKENS(1) /var2=!TOKENS(1) /fname=!CMDEND.) * Raynald Levesque rlevesque@videotron.ca 2001/03/24.

GET FILE=!fname. COMPUTE dummy=1. N OF CASES 1. MATCH FILES FILE=* /BY dummy /KEEP=!var1 TO !var2. FLIP. COMPUTE dummy=1.

MATCH FILES FILE=* /BY dummy /FIRST=first /LAST=last. DO IF first. WRITE OUTFILE='c:\temp\list1.sps' / 'DEFINE !list1()' case_lbl. WRITE OUTFILE='c:\temp\qlist1.sps' / 'DEFINE !qlist1()"' case_lbl'"'. ELSE if not last. WRITE OUTFILE='c:\temp\list1.sps' / " "case_lbl. WRITE OUTFILE='c:\temp\qlist1.sps' / " '"case_lbl"'". ELSE. WRITE OUTFILE='c:\temp\list1.sps' /" "case_lbl ' !ENDDEFINE'. WRITE OUTFILE='c:\temp\qlist1.sps' /" '"case_lbl"'" ' !ENDDEFINE'. END IF. EXECUTE.

GET FILE=!fname. INCLUDE FILE='c:\temp\list1.sps'. * qlist1 = list1 with quoted variable names. INCLUDE FILE='c:\temp\qlist1.sps'. !ENDDEFINE. *///////////////////////////////////////.

* I assume the 600 variables are consecutives, that is, there are no string variables between the 1st and 600th numeric variables. * Here I use only 5 variables to illustrate the procedure.

DATA LIST LIST /g x345 v3 b k. BEGIN DATA. 1.21 2.49 3.01 5.51 41.98 2.33 5.67 1.75 4.22 6.02 END DATA.

SAVE OUTFILE='c:\temp\mydata.sav'.

SET MPRINT=yes.

* The following code does the job. !DEfList var1=g var2=k fname="c:\temp\mydata.sav".

DO REPEAT v=!list1. COMPUTE v=RND(v). FORMATS v(F8.0). END REPEAT PRINT. EXECUTE.

Have fun!

Raynald Levesque rlevesque@videotron.ca

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Paul W. Jeffries Sent: Friday, March 30, 2001 7:23 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: changing variable display properties.

Dear list,

I have an SPSS data file with about 600 numeric variables. Right now the data is displayed to two decimal places. I would like to round each value to the nearest interger and display each value to zero decimal places. Is there a way to do this without manually clicking on each variable and chaning its display proterites?

Any help is appreciated, Paul W. Jeffries Department of Psychology SUNY--Stony Brook Stony Brook NY 11794-2500


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