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 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 21 Dec 2006 00:45:40 -0800
Reply-To:   zenny <pengz.q@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   zenny <pengz.q@GMAIL.COM>
Organization:   http://groups.google.com
Subject:   Re: another query on macro variable
Comments:   To: sas-l@uga.edu
In-Reply-To:   <200612210800.kBL7sLkc002377@mailgw.cc.uga.edu>
Content-Type:   text/plain; charset="gb2312"

Actually this code is for different datasets, each dataset contains only one home, but in each dataset, there are many records, ranking by days. I use this code to read in the original data file of each home, and need to create these variables. So in each dataset, I need to delete the variables like credit16, 17 and credit 34,37. The code should be like:

%do i=1 %to &num; %do j=1 %to &maxv; if &j<=mem(&i) then do; if member =&i then do; do k=1 to length(cards) if substr(cards, k,1)=&j then credit&i&j=1; end; end; end; %end; %end;

Thanks!

"Jim Groeneveld дµÀ£º " > Hi Zenny, > > So far you presented an example resulting on just one record. > If you have more records in reality with different numbers of home members > you would have different variables with missing values for every record. > In that case you can't delete them as they are not missing for other > records. Deleting variables applies to all records in a dataset. > > Regards - Jim. > -- > Jim Groeneveld, Netherlands > Statistician, SAS consultant > home.hccnet.nl/jim.groeneveld > > My computer is a long way from home and only sparsely can access SAS-L. > > On Wed, 20 Dec 2006 23:47:35 -0800, zenny <pengz.q@GMAIL.COM> wrote: > > >Thanks! What I want to achieve is just to create new variables > >according to the number of home members and how many cards they hold. > >This is a practical question because my original data is in Fixed ASCII > >and coded. I need to subtract them out to fit the format according to > >the situations of different homes. So that is the code I wrote. Thanks > >for your codes. However, I still need to delete those variables with > >missing values. How could I do that? or not to create them from the > >beginning? Since I need to use this code for many homes, I do not want > >to delete them by writing them down in each time. Could I do this in > >the macro? > > > >thanks, > >zenny


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