Date: Wed, 29 Dec 1999 12:41:31 +0100
Reply-To: Frank Poppe <firstname.lastname@example.org>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Frank Poppe <Frank.Poppe@KNOWARE.NL>
Subject: Re: Proc SQL labels
When you say "I have labeled the fields" do you mean that you actually
assigned SAS labels to the variables, additionally to their *names*? I
suspect you mean you have *named* the variables MO1, etc.
So *labels* have to be assigned.
Next question: will MO27 *always* correspond to March1999, or will this
shift in time. That determines when and how in the
data-import/massage/analysis/print process the labels should be assigned.
If the data goes through a DATA step somewhere, assign a label as in:
LABEL MO27 = "March 1999" ;
or in SQL:
... Select MO27 "March 1999" From .... ;
Additionally you could generate those statement using macro language.
Something like (using the DATA step alternative and supposing MO27 is always
%MACRO LABEL ( last ) ;
%let year = 1997 ;
%let names = Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ;
%let month = 1 ;
%DO i = 1 %to &Last ;
MO&i = "%scan ( &names , &month ) &year"
%let month = %eval ( &month + 1 ) ;
%if ( &month = 13 ) %then %do ;
%let month = 1 ;
%let year = %eval ( &year + 1 ) ;
set nolab ;
%label ( 27 ) ;
PW Consulting BV - the Netherlands
<email@example.com> wrote in message news:firstname.lastname@example.org...
> I am desperately in need of assistance. I have used Proc SQL to create
> a listing of dollar amounts for two different time periods and then
> created calculations for percentage differences between the time
> periods. I have a time series of monthly data starting with 1/97 and
> continuing through 3/99. I intend to update the database and continue
> the analysis as we get more monthly data in the future.
> I have labeled the fields in my dataset as MO1 (stands for month 1 - not
> very elegant but it has worked up until now), MO2, MO3 etc continuing to
> MO27 which corresponds to the value of March of 1999. Thus, each
> observation contains (currently) 27 months of data. I have a little
> over 2 million observations. The results in Proc SQL are fine. I am
> basically comparing two months side by side and finding their percentage
> differences. Thus I may be comparing MO25 with MO26 and finding the
> percentage change during these two time periods. This is fine and
> works well. However, my users find column headings such as MO25 and
> MO26 in the Proc SQL output too cryptic (a valid point) and would rather
> see Jan99 and Feb99 or something a little more descriptive.
> My question is: how do I create more descriptive labels, keeping in mind
> my dataset will grow as we obtain more monthly data? My user dictates
> which months they want to see in the report, so hardcoding it every time
> they change their mind is a real pain. And then how do I feed these
> labels to Proc SQL to change my headings to something more palatable
> than MO1, MO2 etc to my users? I know the simple answer is to change
> the names of the fields in the data step itself but I am doing some
> rather complex time series calculations on it and I find it easier to
> use if I use a simple consecutive numbering sequence like I have
> Any help will be greatly appreciated
> Dave Jensen
> Sent via Deja.com http://www.deja.com/
> Before you buy.