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 (September 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 13 Sep 2009 00:47:56 -0700
Reply-To:     Patrick <patrick.matter@GMX.CH>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Patrick <patrick.matter@GMX.CH>
Organization: http://groups.google.com
Subject:      Re: Renaming a variable which has hyphen
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

Hi

The issue is that a dash has often a meaning withing SAS (i.e. a minus sign) and therefore causes problems as part of a SAS variable name.

Best would be not to have such names in any SAS dataset (i.e. using EG's import wizard for Excel you can change the variable name already during import).

The following should work:

PROC CORR DATA=SAMPLE; VAR ABDOMINAL 'ANTI-DEPRESSION'n; RUN;

...or rename the variable first in the dataset:

proc datasets lib=work nodetails nolist; modify SAMPLE; rename 'anti-depression'n=anti_depression; quit;

PROC CORR DATA=SAMPLE; VAR ABDOMINAL ANTIDEPRESSION; RUN;

HTH Patrick


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