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 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 24 Dec 2009 16:47:21 -0800
Reply-To:     Anne <amz51076@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Anne <amz51076@GMAIL.COM>
Organization: http://groups.google.com
Subject:      SAS value labels not applying
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

I'm trying to recode some variables and make new value labels for them. This generally works for most of the variables I am creating, but four variables stubbornly refuse to take the value labels I assign. Specifically, using the following code, PREGNANT, RELATIONSHIP, FREQUENCY, and SEVERITY simply do not take the value labels assigned, which is apparent when I check the Viewtable window. I've rewritten the code several times, but it doesn't seem to make a difference. And I'm not getting an error message when I run the code at all, so I have nothing to go on to help me determine where the problem is. Any help you can give would be much appreciated.

PROC FORMAT; VALUE $EDU 1 ="<12 Yrs" 2 ="12 Yrs" 3 =">12 Yrs" ; VALUE $RACE 1 ="Black" 2 ="White" 3 ="Hispanic" ; VALUE $MARITAL 1 ="Single" 2 ="Married" 3 ="Other" ; VALUE $RELATIONSHIP 1 ="Current" 2 ="Former/Ex" ; VALUE $PREGNANT 1 ="Recently Pregnant" 2 ="Not Recently Pregnant" ; VALUE $INCOME 1 ="<$5,000" 2 ="$5,000 to 10,000" 3 ="$10,000 to 20,000" 4 =">$20,000" ; VALUE $FREQUENCY 1 ="Yes" 2 ="No" ; VALUE $SEVERITY 1 ="Yes" 2 ="No" ; RUN;

data thesis.thesisdata2; set thesis.thesisdata1; IF B1AGE GE 18 AND B1AGE LE 20 THEN AGE = '18 to 20'; ELSE IF B1AGE GE 21 AND B1AGE LE 25 THEN AGE = '21 to 25'; ELSE IF B1AGE GE 26 AND B1AGE LE 30 THEN AGE = '26 to 30'; ELSE IF B1AGE GE 31 AND B1AGE LE 35 THEN AGE = '31 to 35'; ELSE IF B1AGE GE 36 THEN AGE = '36+'; IF B2EDU EQ 1 OR B2EDU EQ 2 OR B2EDU EQ 3 THEN EDU = '1'; ELSE IF B2EDU EQ 4 THEN EDU = '2'; ELSE IF B2EDU GE 5 AND B2EDU LE 9 THEN EDU = '3'; IF B6RACE EQ 1 THEN RACE = '1'; ELSE IF B6RACE EQ 2 THEN RACE = '2'; ELSE IF B6RACE EQ 3 THEN RACE = '3'; IF B8MARITL EQ 1 OR B8MARITL EQ 8 THEN MARITAL = '1'; ELSE IF B8MARITL GE 2 AND B8MARITL LE 3 THEN MARITAL = '2'; ELSE IF B8MARITL GE 4 AND B8MARITL LE 7 THEN MARITAL = '3'; IF RELAC1 IN (1, 3, 5, 7, 9) THEN RELATIONSHIP = '1'; ELSE IF RELAC1 IN (2, 4, 6, 8, 10, 11) THEN RELATIONSHIP = '2'; IF E13PRGNT IN (1, 2) THEN PREGNANT = '1'; ELSE IF E13PRGNT EQ 3 THEN PREGNANT = '2'; IF F17HINCM EQ 1 THEN INCOME = '1'; ELSE IF F17HINCM EQ 2 THEN INCOME = '2'; ELSE IF F17HINCM EQ 3 THEN INCOME = '3'; ELSE IF F17HINCM IN (4, 5, 6, 7, 8, 9) THEN INCOME = '4'; IF N1FRQNCY EQ 1 THEN FREQUENCY = '1'; ELSE IF N1FRQNCY IN(2, 3) THEN FREQUENCY = '2'; IF N2SVRITY EQ 1 THEN SEVERITY = '1'; ELSE IF N2SVRITY IN (2, 3) THEN SEVERITY = '2';

FORMAT EDU $EDU. RACE $RACE. MARITAL $MARITAL. INCOME $INCOME. RELATIONSHIP $RELATIONSHIP. PREGNANT $PREGNANT. FREQUENCY $FREQUENCY. SEVERITY $SEVERITY.; RUN;

Thanks, Anne


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