Date: Sun, 28 Dec 2003 16:22:53 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Using RETAIN to reorder with a Name Prefix list (colon
specifica tion)
Content-Type: text/plain; format=flowed
Sorry it has taken me so long on this reply but alas the holidays and all,
Okay here is my take on the situation.
Using the colon operators to specify a range of variables; these variables
dont get initilaized until the set statement. Where as the variables(s)
that are specified without the colon operator get initialized with the
retain statement. This is due to the fact that a colon operator simple is a
wild card match (thingy < hey its a technical term here>) and since SAS
doesn't explicitly know the variable(s) in the range you want it cant
initilize them, in other words it needs a name to call these variables in
the retain statement other than a wild card match in order to set up the PDV
and initlize these variables.
Take the following example:
DATA B ;
PUT _ALL_;
RETAIN A: B C: 0;
PUT _ALL_;
RUN ;
results:
B=0 _ERROR_=0 _N_=1
B=0 _ERROR_=0 _N_=1
Here we have no a's or c's but we do have (B).
Not sure if this makes any since but its what I figure is happening.
Toby Dunn
From: "Chakravarthy, Venky" <Venky.Chakravarthy@PFIZER.COM>
Reply-To: "Chakravarthy, Venky" <Venky.Chakravarthy@PFIZER.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Using RETAIN to reorder with a Name Prefix list (colon specifica
tion)
Date: Wed, 24 Dec 2003 13:18:32 -0500
MIME-Version: 1.0
Received: from mc3-f33.hotmail.com ([64.4.50.169]) by mc3-s6.hotmail.com
with Microsoft SMTPSVC(5.0.2195.6713); Wed, 24 Dec 2003 10:19:37 -0800
Received: from malibu.cc.uga.edu ([128.192.1.103]) by mc3-f33.hotmail.com
with Microsoft SMTPSVC(5.0.2195.6713); Wed, 24 Dec 2003 10:18:42 -0800
Received: from listserv.cc.uga.edu (128.192.1.75) by malibu.cc.uga.edu
(LSMTP for Windows NT v1.1b) with SMTP id <1.00A8CD20@malibu.cc.uga.edu>;
Wed, 24 Dec 2003 13:18:41 -0500
Received: from LISTSERV.UGA.EDU by LISTSERV.UGA.EDU (LISTSERV-TCP/IP release
1.8d) with spool id 293827 for SAS-L@LISTSERV.UGA.EDU; Wed, 24 Dec
2003 13:18:41 -0500
Received: from mail12-haw-R.bigfish.com (mail-haw.bigfish.com
[12.129.199.61]) by listserv.cc.uga.edu (8.11.6/8.11.6) with ESMTP
id hBOIIfS11041 for <sas-l@listserv.uga.edu>; Wed, 24 Dec 2003
13:18:41 -0500
Received: from mail12-haw.bigfish.com (localhost.localdomain [127.0.0.1]) by
mail12-haw-R.bigfish.com (Postfix) with ESMTP id 4E80C33E3D2 for
<sas-l@listserv.uga.edu>; Wed, 24 Dec 2003 18:18:35 +0000 (UCT)
Received: by mail12-haw (MessageSwitch) id 1072289915305259_31342; Wed, 24
Dec 2003 18:18:35 +0000 (UCT)
Received: from gsun56.pfizer.com (unknown [12.18.36.49]) by
mail12-haw.bigfish.com (Postfix) with ESMTP id 0FA9133E12A for
<sas-l@listserv.uga.edu>; Wed, 24 Dec 2003 18:18:35 +0000 (UCT)
Received: from groexms02.pfizer.com (localhost [127.0.0.1]) by
gsun56.pfizer.com (Switch-3.0.5/Switch-3.0.0) with ESMTP id
hBOIIYBs024264 for <sas-l@listserv.uga.edu>; Wed, 24 Dec 2003
13:18:34 -0500 (EST)
Received: from groexcn04.pfizer.com (unverified) by groexms02.pfizer.com
(Content Technologies SMTPRS 4.2.1) with ESMTP id
<T66b4cbb729ac1e08e414b@groexms02.pfizer.com> for
<sas-l@listserv.uga.edu>; Wed, 24 Dec 2003 13:18:33 -0500
Received: by groexcn04.pfizer.com with Internet Mail Service (5.5.2654.89)
id <X8AZYRZQ>; Wed, 24 Dec 2003 13:18:33 -0500
X-Message-Info: MxAodtZPLiThQ5743twRpuAf905U53fWuA3icWQc/xg=
X-Mailer: Internet Mail Service (5.5.2654.89)
X-BigFish: cv
Message-ID:
<303682BAB5176E47941169F3C8444778B1B6DE@anagrdexm03.research.aa.wl.com>
Newsgroups: bit.listserv.sas-l
Return-Path: owner-sas-l@LISTSERV.UGA.EDU
X-OriginalArrivalTime: 24 Dec 2003 18:18:42.0725 (UTC)
FILETIME=[5CA58D50:01C3CA4A]
Hi,
There have been several discussions on the list about reordering variables.
It is even on the SASware ballot. One of the popular methods discussed is to
use a RETAIN statement before the SET statement.
I observed something today while using a RETAIN statement to reorder the
variables in a data set. When a name prefix list (such as a:) is used to
specify a range of variables those variables get put at the end even if they
were in the beginning in the original. Even worse, it seems to completely
ignore the specified relative order of such groups of variables. If the
original order is c: and a: and you want a: and c: and specify that in the
RETAIN, it is ignored. The original order is maintained. See below for a
simple illustration. Any explanations? Has this been covered before?
data a ;
array c (2) (2*1);
array a (2) (2*1);
b = 2 ;
run ;
title "Before Reordering with RETAIN" ;
proc print ;
run ;
title ;
Before Reordering with RETAIN
Obs c1 c2 a1 a2 b
1 1 1 1 1 2
data b ;
retain a: b c: ;
set a ;
run ;
title "After Reordering with RETAIN" ;
proc print ;
run ;
title ;
After Reordering with RETAIN
Obs b c1 c2 a1 a2
1 2 1 1 1 1
--------------------------------
Have a Merry Christmas and a Wonderful New Year.
Kind Regards,
_________________________________
Venky Chakravarthy
E-mail: swovcc_AT_hotmail_DOT_com
LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be
privileged. It is intended for the addressee(s) only. Access to this E-mail
by anyone else is unauthorized. If you are not an addressee, any disclosure
or copying of the contents of this E-mail or any action taken (or not taken)
in reliance on it is unauthorized and may be unlawful. If you are not an
addressee, please inform the sender immediately.
_________________________________________________________________
Tired of slow downloads? Compare online deals from your local high-speed
providers now. https://broadband.msn.com