LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (May 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 17 May 2002 13:32:54 -0400
Reply-To:     Quentin McMullen <QuentinMcMullen@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Quentin McMullen <QuentinMcMullen@WESTAT.COM>
Subject:      Re: determining variable type
Comments: To: ""
Content-Type: text/plain; charset="iso-8859-1"

Peter Crawford wrote:

> Hi Quentin McMullen [SMTP:QuentinMcMullen@WESTAT.COM] > If you can make a correct length statement, then you > can use the correct data type in the compare ! > Otherwise you just move the problem to another > place in your code. > I do not understand in what circumstances you would be > able to define the requirements for a compare, but not > know the data type ! > Even if it is a numeric string...... > Unless you are happy with automatic data conversion. > If you want to compare a var. of unknown data type with > missing (blank or . ) then v8 offers the missing() function > like.... > > do until ( missing(var1) ); > which would compile and execute correctly > ====== but only if that is what you need ! >

Hi Peter,

I think you miss my point (or I miss yours). I have dataset work.A with a character variable.

data a; input Var1 $1; cards; x A x a ; run;

Knowing that Var1 is character, I mistakenly thought that I would be ok if I used the correct type in the compare.

data b; do until (upcase(var1)='A'); set a; end; run;

But my point is the above doesn't work. In this case using the correct type in the compare is not enough. SAS makes var1 numeric, despite evidence to the contrary. While I "know" var1 to be character, and make every attempt to treat it above like a proper character variable, SAS still makes it numeric. So to convince SAS that it is character, I must add a statement at the top of the step which will determine the type (length statement, or Bruce's if 0 then set a, etc.).

Kind Regards, --Quentin

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