[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: Re: PROC SQL
From: toby dunn <tobydunn () HOTMAIL ! COM>
Date: 2005-10-31 15:19:26
[Download RAW message or body]
Carol,
No it is not. What it is designed to do is keep the first occurance of an
observation (it looks at the entire observation) which is different than
keeping the first occurance of some value of a variable.
proc sort
data = sashelp.class
out = one ;
by sex ;
run ;
proc sql ;
select distinct sex , name
from one ;
select distinct sex
from one ;
quit ;
Toby Dunn
From: "Srna, Carol (C.)" <csrna@FORD.COM>
Reply-To: "Srna, Carol (C.)" <csrna@FORD.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: PROC SQL
Date: Mon, 31 Oct 2005 09:20:25 -0500
Thank You.
Is SELECT DISTINCT comparable to FIRST dot processing on the DATA
statement?
-----Original Message-----
From: toby dunn [mailto:tobydunn@hotmail.com]
Sent: Monday, October 31, 2005 9:18 AM
To: Srna, Carol (C.); SAS-L@LISTSERV.UGA.EDU
Subject: Re: PROC SQL
Carol,
When creating summary vars in SQL and you dont give the summary var a
name
it will use a temporary name such as _temp001 etc...., simply go back to
your select statement and where you have:
sum(GBS)
put sum(GBS) as SumOfGBS
Now when you look at your output you will see
DSN GBS SumOfGBS
Toby Dunn
From: "Srna, Carol (C.)" <csrna@FORD.COM>
Reply-To: "Srna, Carol (C.)" <csrna@FORD.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: PROC SQL
Date: Mon, 31 Oct 2005 08:14:51 -0500
Thank You, Gadi. I got wanted results.
What is _TEMG001?
Thanks again.
1The SAS System
Obs DSN _TEMG001 ======> what is this?
1 AABCC 40
2 CAS 24
3 JHHKK 29
4 XYZZZ 56
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Gadi Ben-Avi
Sent: Monday, October 31, 2005 8:08 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: PROC SQL
Hi,
It should be:
PROC SQL;
CREATE TABLE DSNS AS
SELECT DISTINCT DSN, sum(gbs) FROM TEMP1 group by dsn;
Gadi
""Srna, Carol (C.)"" <csrna@FORD.COM> wrote in message
news:A3D5552AD7F7BB4A978B8B4A376775F505B8B661@na1ecm60.dearborn.ford.com
...
> Hi All. What I want is to sum the GBS everytime the DSN variable >
changes. What I have is incorrect and I am not sure how to correct >
the error.
> "ERROR: Invalid option name GBS."
> I am researching.
> Thanks for all you help.
> ~~Carol
>
>
> DATA TEMP;
> RETAIN GBS;
> INPUT DSN $ 8-12 GBS 17-18;
> CARDS;
> CAS 23
> CAS 1
> AABCC 40
> XYZZZ 23
> XYZZZ 33
> JHHKK 14
> JHHKK 15
> ;
> RUN;
>
> PROC SORT DATA=TEMP OUT=TEMP1;
> BY DSN;
> RUN;
>
> PROC SQL;
> CREATE TABLE DSNS AS
> SELECT DISTINCT GBS,DSN FROM TEMP1,
> SUM(GBS);
> QUIT;
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic