LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 20 Aug 2008 09:58:39 -0700
Reply-To:     "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: Proc SQL in SAS or SQL Plus
Comments: To: Kim Brown <kibrown@LADHS.ORG>
In-Reply-To:  <200808201648.m7KGC6hx011291@malibu.cc.uga.edu>
Content-Type: text/plain; charset=iso-8859-1

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > Behalf Of Kim Brown > Sent: Wednesday, August 20, 2008 9:49 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Proc SQL in SAS or SQL Plus > > Hello, > > I'm trying to calculate distinct values. For example if I have: > > X > X > X > X > Y > Y > Z > Z > Z > > I want to calculate the distinct values. When I use distinct > function, I > get the number 3, but I want this outcome: 4X, 2Y and 3Z. Any > suggestions? > > How about something like this:

data have; input var $; cards; X X X X Y Y Z Z Z ; run; proc sql; select var, count(var) as count from have group by var ; quit;

Hope this is helpful,

Dan

Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204


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