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 1999, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 14 Mar 1999 01:51:54 +0000
Reply-To:     John Whittington <medisci@POWERNET.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         John Whittington <medisci@POWERNET.COM>
Subject:      Re: data manipulation
Comments: To: "Christian F. G. Schendera" <cschende@IX.URZ.UNI-HEIDELBERG.DE>
Content-Type: text/plain; charset="us-ascii"

At 19:10 13/03/99 +0100, Christian F. G. Schendera wrote:

>Aaaaaaaaah, sorry for unnecessary confusion!!!!!!!!!!!! >Of course the dataset looks like: > >ID VAR1 VAR2 var3 var4 var5......... >01 1 0 1 0 0 >02 0 1 0 0 1 >03 1 0 0 1 0 >......................................... >I will try to be more precise. All colums contain single, and separated >levels of categorial variables (I have changed the example above). The VARs >stand for GENDER (var1, and 2), and US states. That guy infiled e.g. data >for men (var1) and women(var2), but forgot to define the variable GENDER >(having two levels, var1 and var2), or infiled data columes for the singles >US states (say: Arkansas, var3, >Washinton, var4, etc.) but missed to define the var USSTATES (having here 7 >levels).

Right, Chris, that makes a lot more sense :-). I think what you therefore need is something like:

data new (keep = id gender state) ; array gend(*) var1 var2 ; array stat(*) var2 - var8 ; set yourdata ; do i = 1 to dim(gend) ; if gend(i) = 1 then gender = i ; end ; do i = 1 to dim(stat) ; if stat(i) = 1 then state = i - 2 ; * or whatever - this gives state numbers starting at 1 ; if state = 1 then leave ; * saves a little time if there are many states ; end ; * ... etc etc. for other group of variables ; end ;

I coded the gender items in that way to show the general principle (as with teh States). With only two levels, a simpler solution for gender would be:

if var1 = 1 then gender = 1 ; else gender = 2 ;

Regards,

John

---------------------------------------------------------------- Dr John Whittington, Voice: +44 (0) 1296 730225 Mediscience Services Fax: +44 (0) 1296 738893 Twyford Manor, Twyford, E-mail: medisci@powernet.com Buckingham MK18 4EL, UK mediscience@compuserve.com ----------------------------------------------------------------


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