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 (December 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 2 Dec 2005 15:00:15 -0500
Reply-To:   mah-j@statworks.com
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "mah-j@statworks.com" <msoobader@VERIZON.NET>
Subject:   Re: array help
Comments:   To: iw1junk@comcast.net
In-Reply-To:   <120220051839.26960.439094DD0005A08D00006950220076143805029A06CE9907@comcast.net>
Content-Type:   text/plain; charset="iso-8859-1"

Thanks Ian,

I think some variation on the second suggestion might work. Here is simply what I need for each variable:- if OLD IN (.) then OLD_I=1; else OLD_I =0;

The final data set should contain the original variable names + new variable names (original name plus some extension)as I need to match the old and new variable names in an imputation program as with syntax: old (old_I).

Sorry for not being clearer- it took me a while to figure out exactly what I needed.

Mah-J

-----Original Message----- From: iw1junk@comcast.net [mailto:iw1junk@comcast.net] Sent: Friday, December 02, 2005 1:39 PM To: SAS(r) Discussion Cc: mah-j@statworks.com Subject: Re: array help

Mah-j, You cannot hold status of 55 variables in one variable with the same record structure ( not even with two variables). You could have

array v (55) ... ; array stat (55) ; do i = 1 to dim ( v ) ; /* I am not clear on what is bad */ stat[i] = (v[i] not in ( . )) ; end ;

or perhaps a better structure would be

data problems ( keep = obs name value ) ; set ... ; array v (55) ... ; obs + 1 ; /* or better keys to record */ do i = 1 to dim ( v ) ; stat = (v[i] ^= .) ; if stat = 0 then do ; name = vname ( v[i] ) ; value = v[i] ; output ; end ; run ;

It all depends on what you plan to do with the information. For example

proc freq data = problems ; table obs ; /* how many problems in each observation */ table name ; /* how many problem in each variable */ table value ; /* summary count of bad values */ run ;

Ian Whitlock ================= Date: Fri, 2 Dec 2005 11:19:27 -0500 Reply-To: mah-j@statworks.com Sender: "SAS(r) Discussion" From: "mah-j@statworks.com" <msoobader@VERIZON.NET> Subject: Re: array help Comments: To: Jim Groeneveld <jim1stat@YAHOO.CO.UK> In-Reply-To: <200512021556.jB2EsCN7027273@mailgw.cc.uga.edu> Content-type: text/plain; charset=iso-8859-1 Thanks Jim, This is my dilemma. I have around 55 variables. I'm not sure how to get around ^=. - the problem is some variables have numbers 0,1 some 1,2,3,4,5 and some 0-1000- so all these need to be included with .L (legitimate skip) and .N (not in universe) and not imputed. Maybe the other side of this will work. If var(i)=.P or var(i)=.M or var(i)=. then x=0;? My previous email - noted however that there was a problem with my method as you point out -x always get set to 1. Still I'm not sure you can just use one variable to do this -I think maybe the way to approach it is to duplicate the entire dataset so you have 2 variables ( var1 + var1x)- and then var1x identifies the imputation condition for var1.

Thanks Mah-J


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