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
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 <firstname.lastname@example.org> wrote:
> 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>
> >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. ;
> > VAR1
> >FILE_NO = &k;
> >%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
> >%mend conv_call;
> >Is there a better way of doing this? i.e. instead of writing so many %if %
> else statements?
> > Unlimited freedom, unlimited storage. Get it now