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 (May 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 14 May 2003 22:25:57 +0000
Reply-To:     sashole@bellsouth.net
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Paul Dorfman <paul_dorfman@HOTMAIL.COM>
Subject:      Re: Reading in Variables
Comments: To: magouirkj@NJC.ORG
Content-Type: text/plain; format=flowed

Jeff,

If you do not insist on Q1-Q4 being numeric variables, you can get by with

data a ; input @1 var1 $10. ; cards ; 1 1 2 1 2 3 1 2 3 4 ; run ; data q ; set a ; array qq $1 q1-q4 ; call poke (compress(var1), addr(q1), 4) ; run ;

The array above is just to ensure that Q1-Q4 are consecutive in memory.

Kind regards, ------------------------------ Paul M. Dorfman Jacksonville, FL ------------------------------

>From: Jeff Magouirk <magouirkj@NJC.ORG> > >Dear SAS-L, > >We have a problem. We are reading in a .csv file > >We have a variable that has multiple responses within the variable. > >The responses are left justified and no order. > >VAR1 = 1 2 >VAR1 = 3 4 >VAR1 = 1 2 3 4 >VAR1 = 1 > >The problem becomes we would like to substring VAR1 and place each numeric >in as its own variable. > >The output now looks like this after substringing > >VAR1 = 1 2 Q1=1 Q2=2 Q3= Q4= >VAR1 = 3 4 Q1=3 Q2=4 Q3= Q4= >VAR1 = 1 2 3 4 Q1=1 Q2=2 Q3=3 Q=4 >VAR1 = 4 Q1=4 Q2= Q3= Q4= > >What we would like to accomplish is checking the variables q1-q4 and create >new variables at the end of this file dependent on numeric value in q1-q4. > >Is there an easy way to accomplish this without alot of if then statements. > >Thanks,

_________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


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