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 (February 1997, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 10 Feb 1997 10:11:46 -0500
Reply-To:     "Maria M. Corrada" <mcorrada@WELCHLINK.WELCH.JHU.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         "Maria M. Corrada" <mcorrada@WELCHLINK.WELCH.JHU.EDU>
Subject:      concatenation error
Content-Type: TEXT/PLAIN; charset=US-ASCII

I'm trying to concatenate the values of a few (in this case 4) numeric variables into one new character variable ('newvar'). The program below does what I need. However, if I don't include the length statement, the program doesn't work and in the log I get a message that it converted character variables to numeric, after converting them from numeric to character. Does anybody know why this is? I know that during the concatenation the numeric variables are converted to character, but why does it try to convert them back to numeric if the length statement is not specified?

Thanks for the help.

P.S. The output of the correct program with the length statement is as follows:

OBS VAR1 VAR2 VAR3 VAR4 NEWVAR I 1 1 0 1 0 1010 5

657 data one; 658 var1=1; var2=0; var3=1; var4=0; 659 660 array vars{4} var1-var4; 661 * length newvar $ 9; 662 663 do i = 1 to 4; 664 put i newvar vars{i}; 665 newvar=compress(newvar||vars{i}); 666 end; 667 NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 665:22 665:30 NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column). 665:13 1 . 1 2 0.1 0 3 0.1 1 4 0.11 0 NOTE: The data set WORK.ONE has 1 observations and 6 variables. NOTE: The DATA statement used 0.16 seconds. 668 proc print;run; NOTE: The PROCEDURE PRINT used 0.0 seconds.

OBS VAR1 VAR2 VAR3 VAR4 I NEWVAR 1 1 0 1 0 5 0.11

===================================== Maria M. Corrada, Sc.M. Johns Hopkins University Alzheimer's Disease Research Center 5501 Hopkins Bayview Circle Rm 1B.82 Baltimore, MD 21224 Voice: (410)550-3068 Fax: (410)550-3369


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