```Date: Fri, 9 May 2003 11:06:42 -0400 Reply-To: Sigurd Hermansen Sender: "SAS(r) Discussion" From: Sigurd Hermansen Subject: Re: Combining variables Comments: To: Gianluca Content-Type: text/plain; charset="iso-8859-1" SAS PROC SUMMARY uses binary numbers to accomplish the same result more efficiently for each class of values. It will also handle n-ary variables, although the number of distinct states of ten n-ary variables can add up to very large numbers. The number of distinct states of ten variables often amounts to a small fraction of the maximum number possible. Structural dependencies eliminate many possibilities. Sig -----Original Message----- From: Gianluca [mailto:gianluca.marchi@ITALY.ACNIELSEN.COM] Sent: Wednesday, May 07, 2003 3:55 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Combining variables "Brent Baxter" wrote in message news:200305061955.h46JtOY00992@listserv.cc.uga.edu... > Is there an easy way to combine several character variables into one > variable for the purpose of viewing composite frequencies? I have cases > (drivers) with varying numbers of traffic violations (violations codes > stores in ViolCode01-ViolCode10). I'd like to produce a frequencies table > that show all the violation codes together, rather than the frequencies in > ViolCode01 through ViolCode10. Thanks for any help! Hi Brent, you can use this simple way to codify composite characters: suppose you have 3 characters: A, B, C; they can be present or not and can combine each other. You would face 8 cases: none, only A, only B, only C, A+B, B+C, A+C, A+B+C now we define a new variable X which codifies the events. X=A*2^0+B*2^1+C*2^2 So the previous cases will resolve in: none => X=0 only A => X=1 only B => X=2 only C => X=4 A+B => X=3 B+C => X=6 A+C => X=5 A+B+C => X=7 Obviously you can use this system to manage much more character. Hope this can help you. Bye Gianluca ```

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