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 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 26 May 2000 10:40:15 -0400
Reply-To:     Gary M McQuown <gary.m.mcquown@FRB.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gary M McQuown <gary.m.mcquown@FRB.GOV>
Subject:      SAS Programmers/Data Analysts (3-4 positions) in Springfield Va
Content-type: text/plain; charset=us-ascii

Location: Springfield Va (just South of DC)

Description of candidate qualifications:

SAS Programmers/Data Analysts (3-4 positions)

-BS degree in quantitative area such as Mathematics, Statistics or Operations Research

- 1+ yrs experience

-intermediate level exp with SAS programming, data transformations, data management

-support internal, external clients with Quantitative Analysis

-excellent communication and presentation skills

If interested, please respond directly to:

daniel.b.wetherill@us.pwcglobal.com

DOUG CONRAD <dconrad@CICINFO.COM> on 03/16/2000 11:46:31 AM

Please respond to DOUG CONRAD <dconrad@CICINFO.COM>

To: SAS-L@LISTSERV.UGA.EDU

cc: (bcc: Gary M McQuown/IRM/FRBOG/US)

Subject Re: ISO flexible macro -Answers/responses :

Well that was quick! Thanks all for your input. I now have what I need.

I haven't tested the responses but I think the modular "%nwords" macro that Peter C sent me fits a little better for me. Though, the efficiency of Nancy B's code was humbling. I tried something similar to it before but couldn't get it to increment but this looks real good. Ron Fehd's code was, well, a bit scary for me. I wasn't even thinking in that mode but thanks for the input. Nice to have such variation to problem solving.

For those of you that would like to have the two solutions that I'm considering for your own notes here they are.

Peter C's Response; quote"" change the %do iteration to %while or count the vars with this %nWords() macro

%macro nWords( vars ); %local i j ; %let i = 1; %let j = %scan( &vars, &i, %str( ) ); %do %while( &j ne ); %let i = %eval( 1 + &i ); %let j = %scan( &vars, &i, %str( ) ); %end; %eval( &i - 1 ) %mend nWords;

You would only need to extend your code from %do i=1 %to 8; to %do i=1 %to %nWords( &_list2 );

"" endquote of peter's response

Karen B's response:

quote"" What about something like:

%do %while (%scan((&_list2),&i) > 0);

%let _check=%scan((&_list2),&i);

proc freq data=&input noprint; tables &_check/missing out=__ch1; run;

%let i=%eval(&i+1); %end;

" endquote.

Thanks much again. Doug Conrad

Orig Message:

> Here's a good one for you macro mavens. Your help is appreciated. > > I need a loop to scan through a list of vars ( in a %let statement). The > var in the list becomes a 'tables' var in a proc freq. The vars in the > %let statement could change so I dont want to hard code the number of vars > in that list. I do hardcode an 8 ( for the # of vars in the _list2 > statement). I don't like that. > > Note :there are other macro vars referenced ( &input &pctfail) that are > called outside ( so basically dont bother with those issues). > > The vars in the list are only numeric. It would be OK to have separate > lists for numeric and char vars and run each thru a separate loop. I look > for and format the missings and act on that line depending on its > occurrence. > > *********part of the macro code below *************; > > %local _check _list2 i _fmt; > > %let _list2=patkey age sysage admday > m_admsrc m_admtyp m_disp m_gender ; > > %do i=1 %to 8; > %let _check=%scan(&&_list2,&i); > > proc freq data=&input noprint; > tables &_check/missing out=__ch1; > run; > > other code........ > > %end; > > other code..... > > > > Thanks much in advance. > Doug Conrad


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