Date: Wed, 31 May 2006 09:39:38 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: macro fand filename
On Wed, 31 May 2006 06:49:23 -0400, Gerhard Hellriegel <ghellrieg@T-
>no, thats totally wrong. First is, you try to use statements in open code,
>which are only possible IN datasteps.
>Second: you cannot use datastep variables in the name of a output dataset.
Third. Creating a lot of small data sets is usually a bad idea. Instead,
leave the data in one large data set and use BY and/or WHERE processing to
stratify and/or segregate. Perhaps create an index to speed things up.
>One of some possible solutions for that what you want is a macro:
> %let no_years=0;
> %let no_months;
> data _null_;
> set temp.ff1;
>here you should calculate the month and years and write them to macro
> call symput("no_years",no_years);
> call symput("y"!!compress(put(no_years,8.)),?????); dont know where your
>year comes from... something like year(date) ?
> also the months...
>all in all its not clear to me, wher you get the yyyymm from. In my
>you should use a SAS-date variable as start, norm all months to the 1st
>of... and count the start to end by INTNX("month",...)
>The names you can generate by put(year(dates),z4.) and same for months.
>that you use in a
>%do i=&start %to &end;
> %do i=1 &start %to &end;
> if datum=&&xxxxx&i then output &&name&i;
>the logic you need, you must fill in.
>On Wed, 31 May 2006 00:07:09 -0700, skyline <carf4F@GMAIL.COM> wrote:
>>I would like to do the following and I would like to know whether it is
>>the correct thing to do;
>>do myear=begyear to endyear;
>>do mmonth=begmon to endmon;
>>if yyyymm eq myear*100+mmonth;
>>Here I try to create files with the name perms-myear-mmonth for each
>>value of myear and mmonth.
>>Is the above code correct? If not, what is the correct one?