LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (January 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 24 Jan 2006 06:29:42 -0500
Reply-To:   "SASsy :-)" <sas__l@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "SASsy :-)" <sas__l@HOTMAIL.COM>
Subject:   Re: Using formatted variable (format values) as class/group

On Tue, 24 Jan 2006 02:51:28 -0800, GuidoT <cymraeg_erict@HOTMAIL.COM> wrote:

>Hi s, > >Sorry, it was my confusion about what the WEEKV format does. WEEKV is >a SAS 9 format. It gives a 1 to 1 match for input date and output week >string (Week and day number). I'm running SAS 8.2 and I had >(incorrectly) assumed that WEEKV was a private format that resulted in >a week number - So 7 days go to one output string. With this >assumption, the SQL without the CALCULATED gives a summary by week for >each of the input records. WIth CALCULATED (or 1) it produces one >record for each week. > >That is, without calculated it performs the summary statistics grouped >by the formatted value of the group, but outputs the statistics for >every record selected. > >Using GROUP BY CALCULATED DATUM_C (or GROUP BY 1) it produces the stats >for the group and only outputs one record for each group. > >++ Guido

Alright, thanks for your reply. Being practically braindead about sql myself, I'm not going to jump into discussions on how it works! :-) On the other hand, I'm not convinced your explanation holds water.. (i.e. does it really matter to sql who supplied the format?) Just consider this:

data test; infile datalines; input datum date9. user $; *format datum weekv5.; datalines; 01JAN2006 4452 05JAN2006 4457 07JAN2006 4457 11JAN2006 4392 12JAN2006 4889 14JAN2006 4400 15JAN2006 4490 17JAN2006 4901 ; run;

proc format; value userdef 16802='05W52' 16806,16808='06W01' 16812,16813,16815,16816='06W02' 16818='06W03' ;

proc sql; select put(datum, weekv5.) as datum_c, count(user) as n from test group by datum_c; quit;

proc sql; select put(datum, userdef.) as datum_c, count(user) as n from test group by datum_c; quit;

But like I said, I have no idea really... If I got you wrong, which is quite likely, please see if you can examplify your point on the above data. That way I'll probably get it.. Thanks, s


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