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 (July 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 29 Jul 2008 14:46:27 +0200
Reply-To:     Erwan LE DU <dotker@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Erwan LE DU <dotker@GMAIL.COM>
Subject:      Re: I need help with proc IML
Comments: To: Ian Wakeling <Ian.Wakeling@hanani.qistats.co.uk>
In-Reply-To:  <8639181543859668168@unknownmsgid>
Content-Type: text/plain; charset=ISO-8859-1

Hi Ian,

Wonderful, that is exactly the statement I needed.

Thanks a lot

Erwan

On Tue, Jul 29, 2008 at 2:19 PM, Ian Wakeling < Ian.Wakeling@hanani.qistats.co.uk> wrote:

> > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Erwan > LE DU > Sent: 29 July 2008 10:19 > To: SAS-L@LISTSERV.UGA.EDU > Subject: I need help with proc IML > > Dear listers, > > I am an (old) new SAS user and I have some difficulties using the proc IML. > > I am trying to figure out how to use the USE and READ statements in proc > IML > with several datasets that are output from the TABULATE procedure. > The datasets names are (test1-test5). I would like to use them in loops > with > proc IML. > > I have first tried to write USE concat('Test',char(i,1)) /*i referencing > the > dataset number*/ > That didn't work. > > I then tried to assign the dataset name to a value. > > curr_data=concat('Test',char(i,1)); > USE curr_data; > > That doesn't work either. > > > > 2. The second point I don't understand is why the READ statement or others > don't either work with loops. > > do j= minV to max(VAR[i]); > I was forced to assign minV a value (minV=min(VAR[i]) rather than just > writing > do j=max(VAR[i]) to max(VAR[i]) > > - I have the same problem with the READ statement. IML doesn't recognize : > read all var{ concat('PctN_',pctSuffix[i])} into ar where (VAR[i]=j); > - I needed to write : > break_var=concat('PctN_',pctSuffix[i]); > an_var=VAR[i]; > read all var{ break_var } into ar where (an_var=j); > > > Any help would be greatly appreciated > > > Below my proc : > > > proc iml; > show > datasets; > show > contents; > reset > print; > pctSuffix={ > "100" "010" "110"}; > print > pctSuffix; > countryVal={ > . 2 4}; > print > countryVal; > specVal={ > . 1 2 3}; > print > specVal; > AN_TYPE={ > FREQ > FREQ > FREQ > FREQ > FREQ > }; > print > AN_TYPE; > VAR={ > Q01_1a > Q01_2a > Q01_3a > Q01_4a > Q01_5a > }; > print > VAR; > > start > myproc; > do > i=2 to NCOL(AN_TYPE); > print i; > if AN_TYPE[i]=FREQ then do; > minV=min(VAR[i]); > do j= minV to max(var[i]); > mydata=concat( > 'Test',char(i,1)); > use mydata; > break_var=concat( > 'PctN_',pctSuffix[i]); > an_var=VAR[i]; > read all var{ break_var } into ar where (an_var=j); > print ar; > end; > end; > end > ; > finish > myproc; > run > myproc; > quit > ; > > >


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