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 (September 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 5 Sep 2008 10:28:16 -0500
Reply-To:     "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Subject:      Advanced Macro Class
Comments: To: Toby Dunn <tobydunn@hotmail.com>
Content-Type: text/plain; charset=ISO-8859-1

You have been complaining about this class even before you took it. Lets work on these awful examples, so the "Ivory Billed Woodpeckers" can see them and improve this course.

We can start with the example you refer to. What macro technique was being demonstrated? What would be a better example?

When we beat this one to death we can move on to other irritating examples.

On 9/5/08, Toby Dunn <tobydunn@hotmail.com> wrote: > Cherish, > > This is one of those examples I saw and hated in the Advanced Macro class > I attend last week. No macro is needed at all. Ideally you want your > data stored together in one data set, this allows for more efficient > storage and utilization of the data. With that in mind look up the > FileVar option on the Infile Statement. Or search the SAS-L archives as > there are plenty of exmaples their. > > Toby Dunn > > On Fri, 5 Sep 2008 09:29:36 +0100, cherish k <hawks_cherish@YAHOO.CO.IN> > wrote: > > >Hi All, > > > >I have approximately 1000 files in txt format separated by comma. I need > to convert them in SAS datasets with a single conversion code. File > formats are same for all the files. > > > >Only problem being that the file names are in this format: file_000001 > > > >so if the file number is 95 then the file name is: file_000095 > > > >I used the following code > > > >%macro conv(j,k); > > > >data File_&k.; > >infile "C:\Documents and Settings\cherish\My > Documents\Cherish\file_&j..txt" delimiter = ',' MISSOVER DSD lrecl=32767 > firstobs=2 ; > >informat VAR1 best32. ; > >format VAR1 best12. ; > >input > > VAR1 > >; > >FILE_NO = &k; > >run; > > > > > >%mend conv; > > > > > > > >%macro conv_call; > > > >%do i = 1 %to 1000; > > > > %if %eval(&i) < 10 %then %conv(00000&i.,&i.);%else %if %eval(&i) < > 100 %then %conv(0000&i.,&i.);%else %if %eval(&i) < 1000 %then %conv > (000&i.,&i.); > > > > > >%end; > > > >%mend conv_call; > > > >%conv_call; > > > >Is there a better way of doing this? i.e. instead of writing so many %if % > else statements? > > > >Cherish > > > > > >--------------------------------- > > Unlimited freedom, unlimited storage. Get it now >


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