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 (October 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 25 Oct 2008 17:27:04 -0400
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>"
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>"
Subject:      Re: Array Frustration!!!!

On Sat, 25 Oct 2008 14:31:10 -0400, Lewis Jordan <lewjord@UGA.EDU> wrote:

>I am trying to pass an array of variables into another array. In the "data two" step, if I specify x{1}=&fyknot1, it works fine. However, this is inefficient and I don't want to have to write out each variable. What am I doing wrong in the "data two" do loop? > >Thanks in advance. -Lewis > >data one; >array knots{5}; > do i=1 to 5; > knots{i}=ranuni(38211); > call symput (compress('fyknot'||i),trim(left(knots{i}))); > end; >drop i; >run; > >data two;set one; >array x{5}; > do i=1 to 5; > x{i}=&fyknot{i}; /*HELP ME HERE?????*/

There is likely a simpler way to do whatever really needs doing, but here's your help:

x{i}= symget( cats( 'fyknot' , i ) ) ;

> end; >output; >run;quit;

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