Date: Sun, 4 Feb 2007 22:33:50 -0800
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: SAS "Whys??"
Content-Type: text/plain; format=flowed
>Hi all -
>I have a couple of curiousity questions about the use of SAS that I am
>hoping someone can shed some light on:
>1. Why do you have to sort your datasets before you use them with a
>'by' statement (like with a merge for example). How come SAS doesn't
>just automatically sort it for you in this instance, or at least have
>an option to set to perform this if it is not properly sorted (maybe
>there is an option that I am not aware of!! ).
>2. What is the difference between using a 'SET DS1 DS2 DS3' in a data
>step vs. Using PROC APPEND' to concatenate data, or I should say under
>what circumstances what you want to use one vs. another methed for
>concatenating data. And how does SAS handle the properties of
>variables if they are different between datasets in a SET statement
>(like formats and character lengths).
>I am sure I could find out all this information by doing a little
>reasearch on my own, but I figured someone could give me some insight
>in a more timely manner ; )
>Thanks for your time and advice in advance!!
In addition to all the excellent advice you have already received, let me
add a couple thoughts.
Your question #1 overlooks one of the useful features of SAS. The
ability to use a by-variable to *group* your data when it is grouped
properly (all the observations for level j are together, for every j), but
the data are not sorted on your grouping variable. In this case, SAS
lets us use the by-variable with a NOTSORTED keyword. The NOTSORTED
keyword tells SAS to expect that some blocks of the by-variable values
are out of order, and not to have a fit about it. It lets us tell SAS that
we know what we are doing, and it lets us do work which otherwise
would require indices or sorting to accomplish.
Given the size of some of the data sets I work with sometimes, I
am incredibly glad that SAS does *not* want to sort everything in
sight, and that it does *not* really believe me if I set the SORTEDBY
David L. Cassell
3115 NW Norwood Pl.
Corvallis OR 97330
FREE online classifieds from Windows Live Expo – buy and sell with people