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 (June 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 1 Jun 2005 16:35:21 +0000
Reply-To:     iw1junk@COMCAST.NET
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <iw1junk@COMCAST.NET>
Subject:      Re: probably a macro question

Joe,

You have written SCL code for so long that you have forgotten how simple and short the corresponding DATA step is.

data _null_ ; set xx ; if i=1 then call symputx('i',d1); else if i=2 then call symputx('i',d2); else if i=3 then call symputx('i',d3); checkit=symget('i'); put checkit=; run ;

Of course, in both the SCL code and DATA step code, the linear search and needless introduction of the macro facility makes this a poor way to solve the original problem, but then you (as previously stated in http://www.listserv.uga.edu/cgi-bin /wa?A2=ind0505B&L=sas-l&P=R23682&D=1&H=0&O=D&T=1 ) are not interested in solving SAS-L problems anyway, so that makes it ok. However, in your own interest to promote SCL, you should find simple examples (say with 50 or less lines of code) of SCL that are not better done without SCL.

If there are no such short examples or you are unable to find them, then it would be interesting to discuss how much code it takes to make SCL worth while. In short, what makes a problem a good candidate for an AF/SCL solution?

Ian Whitlock ================== Date: Tue, 31 May 2005 23:22:13 -0400 Reply-To: joewhitehurst@bellsouth.net Sender: "SAS(r) Discussion" From: Joe Whitehurst <joewhitehurst@BELLSOUTH.NET> Organization: Analyticum, Inc. Subject: Re: probably a macro question Comments: To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM> In-Reply-To: <200505312346.j4VNkm5g001639@listserv.cc.uga.edu> Content-Type: text/plain; charset="US-ASCII" Howard, Whereas the antiquated Macro Language is neither necessary nor suitable for Lulu's problem, SAS Component Language _does_ allow one to set a macro variable's value in a datastep and retrieve and use its value in the _same_ datastep contrary to what "...is all well known. A macro variable established in one step cannot affect code until the next step". It's probably worthwhile to illustrate with a counter example: length i d1 d2 d3 checkit 8; Init: control asis; submit continue; data xx; input i d1 d2 d3; datalines; 1 45 67 99 3 54 33 78 2 7 9 6 ; run; data xx2/view=xx2; set xx; run; endsubmit; xx_dsid=open('xx2','i'); call set(xx_dsid); do while(fetch(xx_dsid)=0); if i=1 then call symputn('i',d1); else if i=2 then call symputn('i',d2); else if i=3 then call symputn('i',d3); checkit=symgetn('i'); put checkit=; end; return;

The DO LOOP is actually inside an executing datastep and it clearly can assign a macro variable a value and then retrieve it and use it in the same step. Joe Whitehurst <snip>


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