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 (September 1999)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 15 Sep 1999 16:58:57 +0200
Reply-To:     Fabrizio.Arosio@ROTTA.COM
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Fabrizio Arosio <Fabrizio.Arosio@ROTTA.COM>
Subject:      Re: automatic dichotomizing of categorial MRS
Comments: To: "m.feldkircher@ogilvyone.de" <m.feldkircher@ogilvyone.de>
Content-type: text/plain; charset=us-ascii

Martin, I think your problem could be solved with a macro. Try this:

DEFINE Macro(OutVar=!TOKENS(1) /InVar=!ENCLOSE('(',')') /Values=!ENCLOSE('(',')')). Count !LET !SEP=!NULL !DO !I !IN (!Values) !CONCAT(!SEP,!OutVar,!I,"=",!InVar,"(",!I,")") !LET !SEP="/" !DOEND !ENDDEFINE

Supposing you want to count the frequency of values 4,5,10 for the variabiles nA, nB, nC, the macro should be called in the following way:

Macro OutVar=C InVar=(nA nB nC) Values=(4 5 10). execute.

After its execution, the macro will create the variables C4 (frequency of value 4), C5 (frequency of value 5), C10 (frequency of value 10).

I hope this helps you. Fabrizio

Martin Feldkircher <m.feldkircher@OGILVYONE.DE> on 15/09/99 12.08.23

Please respond to "m.feldkircher@ogilvyone.de" <m.feldkircher@ogilvyone.de>

To: SPSSX-L@LISTSERV.UGA.EDU cc: (bcc: Fabrizio Arosio/RRL/IT) Subject: automatic dichotomizing of categorial MRS

i got 30 variables, each got 79 categories. they are categorial variables of a Multi Response Set. I want tu build new dichotomeous varaibles for each of the categories (in total 79 dummies). a person who choose category 1 from any of the 30 variables shall get a "1" in the new dummy variable posse01d , a person who choose category 2 from any of the 30 variables shall get a "1" in the new dummy variable posse02d , etc. i solved that problem with the following command that involved lot of copy'n'paste work.

count posse01d =posse01n posse02n posse03n posse04n posse05n posse06n posse07n posse08n posse09n posse10n posse11n posse12n posse13n posse14n posse15n posse16n posse17n posse18n posse19n posse20n posse21n posse22n posse23n posse24n posse25n posse26n posse27n posse28n posse29n posse30n (1) /posse02d =posse01n posse02n posse03n posse04n posse05n posse06n posse07n posse08n posse09n posse10n posse11n posse12n posse13n posse14n posse15n posse16n posse17n posse18n posse19n posse20n posse21n posse22n posse23n posse24n posse25n posse26n posse27n posse28n posse29n posse30n (2) [..........] /posse79d =posse01n posse02n posse03n posse04n posse05n posse06n posse07n posse08n posse09n posse10n posse11n posse12n posse13n posse14n posse15n posse16n posse17n posse18n posse19n posse20n posse21n posse22n posse23n posse24n posse25n posse26n posse27n posse28n posse29n posse30n (79).

i am sure that there will be an easier solution with vector'n'loop statements. any suggestion?

mf


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